J
JWL
Hi
Suppose I have a site that requires a horizontal line of four images on
each page. This is a design thing and doesn't really have much bearing
on the site's content. The images differ from page to page.
Anyway, using a CSS layout, I left-floated the four divs and placed
<img> tags in them to display the images. But now I'm thinking: would it
be better to place background images in the divs using CSS? By using
contextual selectors I could place exactly the same HTML on each page
and have the CSS select the different images, which would make things
much cleaner. Is there any reason not to do this? I'm not sure whether
to choose one or the other.
Related to that, suppose I do have a div that exists only to display a
background image:
#header {
width: 800px;
height: 100px;
background: url('banner.gif') no-repeat;
}
Is it OK to have an empty div in the HTML:
<div id="header"></div>
Or should I put a space in:
<div id="header"> </div>
Looking at people's source, I've seen both techniques, but I don't know
if it makes the blindest bit of difference to all the browsers I'm
unable to test in.
Thanks for looking!
Suppose I have a site that requires a horizontal line of four images on
each page. This is a design thing and doesn't really have much bearing
on the site's content. The images differ from page to page.
Anyway, using a CSS layout, I left-floated the four divs and placed
<img> tags in them to display the images. But now I'm thinking: would it
be better to place background images in the divs using CSS? By using
contextual selectors I could place exactly the same HTML on each page
and have the CSS select the different images, which would make things
much cleaner. Is there any reason not to do this? I'm not sure whether
to choose one or the other.
Related to that, suppose I do have a div that exists only to display a
background image:
#header {
width: 800px;
height: 100px;
background: url('banner.gif') no-repeat;
}
Is it OK to have an empty div in the HTML:
<div id="header"></div>
Or should I put a space in:
<div id="header"> </div>
Looking at people's source, I've seen both techniques, but I don't know
if it makes the blindest bit of difference to all the browsers I'm
unable to test in.
Thanks for looking!