I have an image gallery for a commerce website which consists of several small thumbnail images and one large image. All of the images are photographs of the same product.

What would be the most meaningful alt attribute to place into these images, given that they are generated dynamically?

  • Are the images the same but different sizes? Or are they different views of the same product?
    – John Conde
    Commented Apr 4, 2012 at 15:51
  • Different views of the same product.
    – Mantorok
    Commented Apr 4, 2012 at 15:51

2 Answers 2


If they are different views for the same product they should have a custom alt attribute that describes what the image shows. After all, that is the purpose of the alt attribute. So one showing the back of the product could say, "Rear view of the Blaster 3000". A close up of a part of it could say, "Big red shiny button on the side of the Blaster 3000". Naturally you will make better descriptions that use keywords that describe what the image is showing which is better for SEO and usability (which is no coincidence). You will probably need to keep these descriptions in a database as a separate field with each image so you can easily add them dynamically.

  • +1 for attribute correction - there's no such things as "alt tags"... sigh Commented Apr 5, 2012 at 3:03
  • 1
    Edited question to reflect this. Tag on the brain...
    – Mantorok
    Commented Apr 5, 2012 at 16:48

Expanding on what John said, contextual descriptions of the images is the best way to go. As an example, you can take a look at other e-commerce sites. I picked a random product from thinkgeek.


Taking a look at the product images, you can get a good idea of how they approach alt text. They have "DIY Guitar Pick Punch Main Image", "Picks punched!", "Playing with a punched pick." and "Punching a pick.". They all describe the images in unique ways.

There are two main considerations. The first is making sure the alt text corresponds with the on-page content. In this example, "DIY Guitar Pick", "picks" and even "punching" match up with text in the page itself, such as the titles and the descriptions. Will this make or break the SEO of the page? Not really, however it does create a more unified presentation which results in a better SEO Optimized page.

The second consideration is simply to describe the images accurately. This is for accessibility. For users with screen readers, or even if the images don't load right, a good alt attribute will provide enough information to let the user know what they're missing.

Now, what you're physically able to do depends on your platform. Many solutions let you define alt attributes for each of the images, and you can configure them to pull those attributes when they generate and embed the image into the page. If it's not that robust, the solution will be a little trickier. If all else fails, just echo the product name into the alt attribute. It will be fairly redundant, but at least you'll meet xHTML standards.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.