Last Updated: February 25, 2016
·
703
· antoniovizuete

Don't Use CSS "display: none"

Two reasons to not use "display: none":
1. The screen readers will not access the hidden code.
2. The search bots will ignore it and its inner code.

You should use next code:

.hidden{
position: absolute;
width: 1px; /* Unaccessible if 0 /
height: 1px; /
Unaccessible if 0 */
margin: -1px;
padding: 0;
border: 0;
clip: rect(0 0 0 0);
overflow: hidden;
}

Source: https://github.com/h5bp/html5-boilerplate

2 Responses
Add your response

How about attribute hidden?

over 1 year ago ·

Sometimes you want that to happen (alert boxes, prompts etc).
For SEO just use:
visibility: hidden;

over 1 year ago ·