You are here: Re: background-position defaults « HTML « IT news, forums, messages
Re: background-position defaults

Posted by Jukka K. Korpela on 09/12/07 14:53

Scripsit JL:

> ... 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?

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

> Or should I specify 'left' to be on the safe side?

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

> So, IOW, if I do this:
>
> #container {
> width: 100px;
> background: #FFF shadow.gif repeat-y;
> }

That's syntactically incorrect, as a CSS checker like
http://jigsaw.w3.org/css-validator/
would have told you. You need to write e.g. url(shadow.gif) instead of just
shadow.gif.

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.

>... should I throw in a 'left':
>
> background: #FFF shadow.gif left repeat-y;

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")
http://www.cs.tut.fi/~jkorpela/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация