On Aug 8, 2008, at 6:45 AM, Bill Moseley wrote:
> First, I'm looking for rules for parsing "background:".
>
> Obviously, not all background properties need to be included.
>
> background: red; # just set the color
The short-hand notation (not only for background but for all
properties where you can use shorthand) resets _all_ properties that
apply to their default (initial) value.
> And, at least in my quick test with Firefox, it seems the order of the
> properties doesn't matter.
They don't matter for background.
> But, every background-* property also supports "inherit", so how do I
> know which property that is associated with?
>
> What does this mean:
>
> background-color: red;
> background: inherit;
>
> or
> background: #eee inherit
That would inherit the background image specified for a parent element
> Can I safely convert all the background-* properties into a shortcut?
shorthand, not shortcut.
And yes, you can do that.
> ...
> But what if I have this:
>
>
> .foo {
> background-image: url(foo.gif);
> background-color: red
> background-repeat: no-repeat;
> background-attachment: inherit;
> background-position: inherit;
> }
That is a tricky one. If you look at
<http://www.w3.org/TR/CSS21/colors.html#propdef-background>
Inherit can only be used once.
.foo {background: inherit} is OK
.foo {background: red inherit} is not OK.
Given that background-attachment and background-position are not
inherited by default, and given that the shorthand notation resets all
properties to their initial values, you'd have to specify them
specifically.
> And what about !important?
>
> .foo {
> background-image: url(foo.gif);
> background-color: red !important
> background-repeat: no-repeat;
> background-attachment: fixed;
> background-position: bottom;
> }
>
> How would that !important be written in the background: property?
> Does it just apply to the color?
.foo {
background: red url(foo.gif) no-repeat fixed bottom !important;
}
will apply to all individual properties listed.
Philippe
---
Philippe Wittenbergh
http://l-c-n.com/
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/