RSS

Hide page content accessibly

11 Apr

Method offered by Jeff Burnz in his AdaptiveThemes article and then improved by community now evolved into a reliable cross-browser technique.

.hidden 
{
    position: absolute !important;
    clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
    clip: rect(1px, 1px, 1px, 1px);
    padding: 0 !important;
    border: 0 !important;
    height: 1px !important;
    width: 1px !important;
    overflow: hidden;
}

This method takes the element out of flow so it doesn’t affect the layout around it. By using height of 1px it fixes the issue with VoiceOver screen reader (Apple) that will not read content of an element that has 0 height.

Though if your gole is to hide content from all users you should use visibility and display of none instead.

.hidden 
{
  visibility: hidden;
  display: none;
}
Advertisements
 
Leave a comment

Posted by on April 11, 2011 in CSS

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: