954,598 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

img src and img backgrounds

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?

katties
Newbie Poster
11 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
 

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.

diafol
Rhod Gilbert Fan (ardav)
Moderator
7,796 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 

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.

twiss
Veteran Poster
1,005 posts since Apr 2010
Reputation Points: 177
Solved Threads: 101
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: