Welcome to WebmasterWorld Guest from

Forum Moderators: ergophobe

Message Too Old, No Replies


alt, images, css



6:31 am on May 23, 2006 (gmt 0)

5+ Year Member

Hello all,
In html markup one can place an image on a page by using <img src="one.gif" width="10" height="10" alt="blah,blah">

The exact same image can be placed on the same page via CSS - body {background: white url(one.gif)}.

In markup the alt attribute is used, in CSS the alt attribute cannot be used.

Should the CSS method of displaying images be used?

Thank you.


11:38 am on May 23, 2006 (gmt 0)

5+ Year Member


If the image is purely for decoration, e.g. a background image, then css is best for displaying these. If the image is relevant to the page, e.g. a photo of a product, then use the <img alt="an explanation of the photo"> method.


5:20 pm on May 23, 2006 (gmt 0)

10+ Year Member

Good advice by 4hero, though i worry that people are starting to use that phrase "images for decoration" the way they use "tables for tabular data"... a vague phrase that isn't always correct.

For any given image, ask yourself this:

"If someone with a screen reader (or with images disabled) came across my page, would I rather have this image be totally invisible, or still be represented by text?"

Sometimes decoration serves a function, and is worth having in the markup.


Featured Threads

Hot Threads This Week

Hot Threads This Month