Re: About multiple backgrounds' syntax

Bert Bos wrote:
>  I don't know what I prefer yet, just trying out some syntax...

I think it makes the most sense to tie the image fallback color to the 
image and make the image required to specify that color since having the 
color without the image it applies to is pointless:

background-image: <bg-image> [ / <color> ]? [, <bg-image> [ / <color> ]? 
]* ;

If you want to allow fallback only for the back-most image, then:

background-image: <bg-image> [, <bg-image>* [, <bg-image> / <color>]? ;

I don't really see a good reason for the restriction though (which 
necessarily exists when you take the <color> / [ <color> ]? approach due 
to <final-bg-layer>).

------------------------------------------------------------------------

Regarding the |background-size| syntax, using either slashes or 
stand-alone parentheses for |background-size| doesn't seem particularly 
intuitive. IMO, it would be best to accept verbosity and go with 
something like...

background-size: <bg-size> | ( <bg-size> ) [, <bg-size | size( <bg-size> 
) ];

...where the functional |size| notation is required in the |background| 
shorthand. Not only would that be more intuitive, but it would allow an 
author to put the |background-size| information anywhere within 
<bg-layer> (or <final-bg-layer>). If you want to reduce complexity, you 
could require the functional notation with |background-size| too.

Otherwise, if you /really/ must go with the least amount of verbosity, I 
think that the parentheses notation makes more sense than the slash 
notation that's currently in the Editor's Draft; it's more functional 
and, I'd say, more elegant.

------------------------------------------------------------------------

Regarding the current fallback color model, you might consider changing 
it entirely to something more powerful. Example:

background-fallback: <color> [ any | all | far ]? [ bg-color | bg-all | 
font-color ]? [ normal | safe ]?;
<color>: fallback color (|transparent| is default)
any (default): use fallback if any one background image fails
all: use fallback only if all background images fail
far: use fallback only if the farthest/bottom-most background image fails
bg-color (default): if property applies, override the background color
bg-all: if property applies, override all backgrounds and replace with 
the color
font-color: if property applies, override the font color (leave the 
backgrounds intact)
normal (default): apply fallback only after a background image failure
safe: apply fallback until all background images have loaded

I don't know whether that's worth integrating into <background> though.

------------------------------------------------------------------------

— Patrick Garies

Received on Thursday, 23 April 2009 05:47:13 UTC