MyBB Community Forums

Full Version: Can bots crawl CSS display:hidden on a div?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Can bots crawl this div in my forum or not ?

<div style="display:none">

hi demo text
hi demo text
hi demo text
hi demo text

</div>

Probably. Hiding it with CSS means it doesn't show in the browser, but it's still there. Browsers don't run javascript and probably ignore CSS like this too. They read what's on the page, not how it looks.
thanks
Although it's worth noting that if you are using this to hide keywords placed only for SEO purposes, certain search engines (google included), will pick up on it and penalize your site in their rankings. Same goes for hiding things by setting the text to the same colour as the background.
Indeed, don't try any of this stuff. Google will find you one way or another. Even the sneakiest trick will get you caught. Rolleyes
Absolutely a bot can crawl that content. And as Charlie Hadden pointed out some SE's like Google might penalize you for doing so.

btw Fábio there is a YT embed MyCode now.

ahh, thanks guys
doing this will be okay ?

<script>
function show(){
document.getElementByd('myDiv').style.display="block";
}
</script>

<a href="#" onclick="show()"> Software Collection </a>
<div id="myDiv" style="display:none;">
A massive list of software collection 
1. mybb
2. bla bla
etc etc
    </div>
This
document.getElementByd('myDiv').style.display="block";
should be like this;
document.getElementByid('myDiv').style.display="block";
Notice the i in between the "By" and "d". This is because you're referring it to find the element by its id attribute.
(2011-12-04, 10:05 AM)sunjava1 Wrote: [ -> ]ahh, thanks guys
doing this will be okay ?

<script>
function show(){
document.getElementByd('myDiv').style.display="block";
}
</script>

<a href="#" onclick="show()"> Software Collection </a>
<div id="myDiv" style="display:none;">
A massive list of software collection 
1. mybb
2. bla bla
etc etc
    </div>

Probably not. Remember a bot doesn't visit a page as you would with the output of a browser, instead, it retrieves the contents of the page as your browser does. What I mean is, if you have for example:

<!doctype HTML>
<html>
<head>....</head>
<div style="visibility: none;">
This is what I want a search bot not to see
</div>
</html>

When the bot crawls your page, it will retrieve the code above (give or take certain lines, depending how it retrieves it.) It will then filter through the code, removing things that it doesn't want. A container such as the div above is available to it, and depending on its algorithm for "punishment," it might notice that you intended the container to be hidden, and in the end, you get penalized for it. Do note however, if you are hiding the container for the purposes of, for example, a "show more" or "show less" feature, don't worry about getting penalized for it, they generally take such things into consideration.

All the best,
Imad Jomaa
(2011-12-04, 04:06 PM)Yaldaram Wrote: [ -> ]This
document.getElementByd('myDiv').style.display="block";
should be like this;
document.getElementByid('myDiv').style.display="block";
Notice the i in between the "By" and "d". This is because you're referring it to find the element by its id attribute.

Yeah I skipped " i " because in haste of writing a demo. Does it works for small " i " too ?
I think its getElementById('myDiv')

Thank you all I got it