Accessibility and alt Attributes

By  on  

The alt attribute is important for a number of reasons:  it describes an image for screen readers used by those without sight or poor sight, it describes the image to bots, and it provides an indicator of what should have loaded if the image fails to load at all.  But what about the case where the image doesn't have much value to be read, because it has accompanying positioned text offscreen?

Don't omit the the alt attribute -- the screen read will read out the image's src attribute.  Gross.  Instead include the alt attribute with an empty value:

<img src="/path/to/image.png" alt="" />

No image alt or src text is read and you're golden!

Recent Features

  • By
    CSS Animations Between Media Queries

    CSS animations are right up there with sliced bread. CSS animations are efficient because they can be hardware accelerated, they require no JavaScript overhead, and they are composed of very little CSS code. Quite often we add CSS transforms to elements via CSS during...

  • By
    9 Mind-Blowing WebGL Demos

    As much as developers now loathe Flash, we're still playing a bit of catch up to natively duplicate the animation capabilities that Adobe's old technology provided us.  Of course we have canvas, an awesome technology, one which I highlighted 9 mind-blowing demos.  Another technology available...

Incredible Demos

  • By
    Link Nudging Using Dojo

    In the past we've tinkered with link nudging with MooTools and link nudging with jQuery. In an effort to familiarize myself with other JavaScript frameworks, we're going to try to duplicate that effect with another awesome framework: Dojo. The JavaScript: Attempt...

  • By
    MooTools TextOverlap Plugin

    Developers everywhere seem to be looking for different ways to make use of JavaScript libraries. Some creations are extremely practical, others aren't. This one may be more on the "aren't" side but used correctly, my TextOverlap plugin could add another interesting design element...

Discussion

  1. Really good! I added a sniping code to my editor to remember the alt attribute. Other attributes very important are the following:

    meta charset='uft-8' (html5) or http-equiv="Content-Type" content="text/html; charset=UTF-8" (html4)

    I’m from Brazil and these tags are really important for softwares that reads screens.

  2. Definitely in agreement with this. When I studied Software Engineering at university we had a module on human-computer interaction and part of it included making your website accessible to those with poor vision.

    Now I always try to have a high contrast between the color of the text and background color being used, and like you mention I always use the alt tags to, for example to prevent spam I put the email address on my sites contact pages in an image and then put the email address in the alt tag as well such as “my name at my domain dot com” so that if anyone is using a screen reader that clearly states what the email address is. I do the same with logos too, put something like “my website dot com logo” for the same reason.

    If the images are of a product or something I try to get some keywords in there, and since doing this I get a few hits from Google image search sometimes, so that can help a bit with SEO and stuff.

    Anyhow thanks for publishing this, I think too many people forget about how important it is.

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!