CSS image replacement
CSS image replacement is a Web design technique that uses Cascading Style Sheets to replace text on a Web page with an image containing that text. It is intended to keep the page accessible to users of screen readers, text-only web browsers, or other browsers where support for images or style sheets is either disabled or nonexistent, while allowing the image to differ between styles. Also named Fahrner image replacement for Todd Fahrner, one of the persons originally credited with the idea of image replacement in 2003.[1] With the introduction of CSS web font support in all major web browsers, CSS image replacement is now little used. MotivationThe typical method of inserting an image in an HTML document is via the
Fahrner image replacement was devised to rectify these issues. ImplementationsThe original Image Replacement implementation[1] described by Douglas Bowman used a heading, inside of which was a <h3 id="firHeader"><span>Sample Headline</span></h3>
Through style sheets, the heading was then given a background containing the desired image, and the #firHeader
{
width: 300px;
height: 50px;
background: #fff url(firHeader.gif) top left no-repeat;
}
#firHeader span
{
display: none;
}
It was soon discovered, however, that this method caused some screen readers to skip over the heading entirely, as they would not read any text that had a #firHeader
{
width: 300px;
height: 50px;
text-indent: -5000px; /* โ Phark */
}
The Phark method had its own problems, however; in visual browsers where CSS was on but images off, nothing would display. Also in 2003, Dave Shea's eponymous Shea method solves both of the issues earlier mentioned, at the cost of an extra <h3 id="header"><span></span>Revised Image Replacement</h3>
By absolutely positioning an empty #header
{
width: 329px;
height: 25px;
position: relative;
}
#header span
{
background: url(firHeader.gif) no-repeat;
position: absolute;
width: 100%;
height: 100%;
}
Over a dozen different methods has since been developed with varying degree of compatibility and complexity.[2] References
External links
|
Portal di Ensiklopedia Dunia