Prev | Current Page 205 | Next

Craig Grannell

"The Essential Guide to CSS and HTML Web Design"

jpg" height="200" width="400" alt="Sunset in
?? Reykjav?­k" />
Perhaps surprisingly, the height and width attributes are actually optional, although I recommend
including them because they assist the browser in determining the size of the
image before it downloads (thereby speeding up the process of laying out the page). The
only two image element attributes required in XHTML are src and alt. The first, src, is the
path to the image file to be displayed; and the second, alt, provides some alternative text
for when the image is not displayed.
Using alt text for accessibility benefits
Alternate text??”usually referred to as ???alt text,??? after its attribute??”is often ignored or
used poorly by designers, but it??™s essential for improving the accessibility of web pages.
Visitors using screen readers rely on the alt attribute??™s value to determine what an image
shows. Therefore, always include a succinct description of the image??™s content and avoid
using the image??™s file name, because that??™s often of little help. Ignoring the alt attribute
not only renders your page invalid according to the W3C recommendations, but it also
means that screen readers (and browsers that cannot display images) end up with something
like this for output: [IMAGE][IMAGE][IMAGE]??”not very helpful, to say the least.
Descriptive alt text for link-based images
Images often take on dual roles, being used for navigation purposes as well as additional
visual impact.


Pages:
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217