Greg Heilers <gN************@earthNOSPAMlink.net> wrote:
If one has a <div> that is completely filled with a
background-image; how does one style it so that the
image *continues* to fill the <div> top-to-bottom,
left-to-right; if the viewer adjusts the font-size
on his browser?
Background images by default repeat to "fill" their container, in CSS2.x
you cannot stretch them (background image stretching is part of the CSS3
proposals, but afaik not yet implemented by any browser).
Not many images look good when stretched, not helped by the fact that
browsers use fast but crude algorithms to do this.
I have everything sized in em's,
so that the actual <div> "box" resizes along with the
text
If the box with the background image contains text then it should be
sized using a relative unit, if you don't then your precious design will
often fall apart with varying user font settings.
If the box doesn't contain any text then there are no problems with
sizing it using the px unit.
Coding the image in the HTML with a 100% width and height creates it's
own problems if the box also contains text. You'd have to take the text
out of the flow to get it to display over the image, this will result in
overflow problems if the text wraps or if the viewport width isn't
sufficient.
The 100% width and height of an image coded in the HTML should be
specified in the CSS, or else the image will blow up to fill the
viewport when the user has CSS disabled of if it doesn't load for some
reason.
--
Spartanicus