Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

5. Adding Images to Your Pages: Meeting ... > Always provide an alternative

Always provide an alternative

One thing you can be sure of on the Web is that you never know exactly which browsers and devices will be used to view your pages. Visitors are likely to show up with mobile devices, screen readers for the visually impaired, browsers that are running over very slow Internet connections (and may retrieve only the text, not the images, of a site), cell phones, Internet-enabled toasters... Who knows?

But in the middle of all this uncertainty you can be prepared. Even if a browser can’t display the images on your page, there is an alternative. You can give the visitor some indication of what information is in the image using the <img> element’s alt attribute. Here’s how it works:

image with no caption

Exercise

In this exercise you’re going to see how your browser handles the alt attribute when you have a broken image. The theory goes that if an image can’t be found, the alt attribute is displayed instead. But not all browsers implement this, so your results may vary. Here’s what you need to do:


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint