I wonder which one is better: adding header image with img src in html, or as a background in CSS.
Also, in source code I can specify alt (for accessibility).
I know IE6 has issues with transparent png.
What is your practice?

Recommended Answers

I always followed the idea that a html image would be good for logos etc, because you can place them in a link, so the user goes to the homepage when clicked.
A big banner across the screen, meant to be a background, should, IMO, be a css background image. …

Jump to Post

All 2 Replies

Member Avatar

I always followed the idea that a html image would be good for logos etc, because you can place them in a link, so the user goes to the homepage when clicked.
A big banner across the screen, meant to be a background, should, IMO, be a css background image. You should be careful with though, I find tiles (repeating small images) are good for big banners, so you can then add detail on top of them, which often makes more sense.

Tiles also look good if you're using a fluid layout. Static images as backgrounds don't tend to work very well in fluids unless they are mega wide - so they get cropped as the screen size gets smaller.

If an image contains meaning, such as text, or is placed inside a paragraph to make something clear (i.e., it doesn't contain decoration) I would think it's better to use an img tag.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.