background-position defaults

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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:

#container {
     width: 100px;
     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;


Re: background-position defaults

Scripsit JL:

Quoted text here. Click to load it

Theoretically, no, since browsers may have default values that differ from
the initial value for a property.

Quoted text here. Click to load it

Why do you ask? If you want 'left', why don't you just say so in your CSS

Quoted text here. Click to load it

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.

Quoted text here. Click to load it

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")

Site Timeline