Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- background-position defaults
September 12, 2007, 1:55 pm
rate this thread
Suppose I have a 100px container and a 100x1 pixel background image that
I want to repeat-y down the container. My question is, can I be
confident that *all* browsers will position the background image at the
far left of the container if I omit any background-position property? Or
should I specify 'left' to be on the safe side?
So, IOW, if I do this:
background: #FFF shadow.gif repeat-y;
Will shadow.gif definitely be positioned against the left edge of the
container div in every visual browser out there, or should I throw in a
background: #FFF shadow.gif left repeat-y;
- Jukka K. Korpela
September 12, 2007, 2:53 pm
Re: background-position defaults
Theoretically, no, since browsers may have default values that differ from
the initial value for a property.
Why do you ask? If you want 'left', why don't you just say so in your CSS
That's syntactically incorrect, as a CSS checker like
would have told you. You need to write e.g. url(shadow.gif) instead of just
But with this fixed, here you _are_ setting background-position (to 0% 0%,
which is equivalent to top left), since the background shorthand _always_
sets _all_ background properties.
That's a matter of taste; maybe it's more informative to someone reading the
CSS code. But it makes no difference in meaning.
Jukka K. Korpela ("Yucca")