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)

New User

10+ Year Member

joined:Dec 28, 2005
votes: 0

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)

Junior Member

10+ Year Member

joined:Apr 4, 2006
votes: 0


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)

Preferred Member

10+ Year Member

joined:Aug 11, 2005
votes: 0

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.


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members