Hey i have been wondering this for some time what is the better solution when creating layouts in CSS i have defined a banner div for my banner image what is the better solution to do set the banner image as the background for the div or insert the banner as an <img src=http://www.webdeveloper.com/forum/archive/index.php/"banner.gif" alt="banner"/> image. Is there any semantic difficulties between the two. Just really wondering what way is the best.
Cheers
Chris Sharkey<img /> is the sensible solution although you will get some morons or people whom think they are hip saying the other method is better.
Just wait 'til the flames come rolling in...Ok thanks Robert i was thinking the same thing as using the <img/> because if a non-enabled css browser rendered the page there would be no background image as it was added using css.
Thanks againBut what if you wanted to float some text over the image?Then it is not a banner in that sense...Gotchya.
So, we're thinking the only thing that will be contained within that one DIV is an image...period.
Cool.A <div> is a generic style container, or you could have used z-index.Originally posted by sharkey182uk
Ok thanks Robert i was thinking the same thing as using the <img/> because if a non-enabled css browser rendered the page there would be no background image as it was added using css.
If you're worried about non-css browsers then you need to be using a table layout anyway. Aside from text overlays, one reason I like putting the image into the background is it removes the absolute image size from the layout equation. As a background it is simply cropped to the size of the div eliminating the major hassles of "a pixel here two pixels there" banner sizing.
Cheers
Chris Sharkey<img /> is the sensible solution although you will get some morons or people whom think they are hip saying the other method is better.
Just wait 'til the flames come rolling in...Ok thanks Robert i was thinking the same thing as using the <img/> because if a non-enabled css browser rendered the page there would be no background image as it was added using css.
Thanks againBut what if you wanted to float some text over the image?Then it is not a banner in that sense...Gotchya.
So, we're thinking the only thing that will be contained within that one DIV is an image...period.
Cool.A <div> is a generic style container, or you could have used z-index.Originally posted by sharkey182uk
Ok thanks Robert i was thinking the same thing as using the <img/> because if a non-enabled css browser rendered the page there would be no background image as it was added using css.
If you're worried about non-css browsers then you need to be using a table layout anyway. Aside from text overlays, one reason I like putting the image into the background is it removes the absolute image size from the layout equation. As a background it is simply cropped to the size of the div eliminating the major hassles of "a pixel here two pixels there" banner sizing.