Css display:none

Hello. Looking for a definitive answer, but keep finding conflicting info.

How does css display:none work with search engines?

If I use

.javaonly {

to hide a whole host of divs, images and paragraphs for non-javascript users, will the search engines see them?

The first thing my javascript will do is remove that class.

The search engines will see what’s in the HTML, so if the divs are in the HTML, the search engines will see them.

If you plan to use display none to hide content then be careful. ralph.m is correct, if it is in the html code, the search engines can see it even if it is not displayed to the user.

The problem with this, of course, is that it’s not great for accessibility. Anyone with JS off will see nothing, and screen readers will ignore anything with display: none; so it would be good at least to check that the JS overrides this for those devices too (I’m not sure about that).