Author: Detlev Fischer (fischer [ at] dias [dot] de)
Date: 12 November 2011
HTML, XHTML and CSS
This failure relates to:
Various techniques exist that use CSS to replace text with background images of text, for example, by specifying an offset that moves the text outside of the viewport. This technique is often used to render headings in fonts that are not widely available on user agents.
In order to ensure that screen reader users will be able to access the underlying text that is removed from the viewport, authors should avoid using CSS to hide the text with display:none
or visibility:hidden
because this will make the replaced text inaccessible for most screen reader users.
Failure Example 1: Replacing heading text by background images and hiding the text with CSS using display:none
Example Code:
<h3 id="replaced-heading_1">
<span>Don't swim in freezing water</span>
</h3>
/* css */
#replaced-heading_1 {
width: 450px;
height: 25px;
background-image: url(heading_1.gif);
}
h3 span {
display: none;
}
Resources are for information purposes only, no endorsement implied.
display: none
or visibility:hidden
If check #2 or check #3 are false, then the failure condition applies and the content fails these Success Criteria.