DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Accessibly Replacing Text With Images

06.09.2007
| 1614 views |
  • submit to reddit
        // There are quite a few methods to do this but here's one I used recently. It replaces the word "Correct" at the end of a sentence with a graphic tick.

HTML

<p>This part of the text is displayed <span class="correct">Correct</span></p>

CSS

span.correct {background:url(tick.gif); margin-left:0.5em; text-indent:21px; position:absolute; overflow:hidden; width:20px; height:19px}