Re: [css3-background]

On Tue, Feb 28, 2012 at 2:11 AM, Lev Solntsev <greli@mail.ru> wrote:
> Of course I can use gradient, Image() or whatever. But isn't it a hack and
> workaround while there is a more obvious way for authors, is it?
> Also I have concerns about performance issues in browsers and
> those concerns contradict to accessibility—what web was created for.
>
> http://www.w3.org/Style/CSS/ says that “Cascading Style Sheets (CSS)
> is a simple mechanism for adding style (e.g., fonts, colors, spacing)
> to Web documents.”
>
> Using any of these workarounds make things more complex than it could be.

Lea gave the main reason why it would be difficult to define - if you
have linked up property-lists, like in the background-* properties (or
the transition-*, or the animation-*, etc.), you typically link up the
corresponding entries in order to form a full set of properties.
background-color doesn't work like this - if you specify a single
background-color, you want it to match up with the *last* background
layer, not the first.  This is different from how property lists work
everywhere else in the language.  It's also unclear what would happen
if you specified multiple background-colors - would you start matching
them from the front instead, or continue matching them against the
end, so the first color is placed in the second-to-last background
layer, etc.?

We could have, several years ago when multiple background layers were
first introduced, made background-color consistent, but that would
mean that the vastly more common case (just wanting a single color at
the end) would require a long list like "background-color:
transparent, transparent, transparent, transparent, blue;".

So, this is an optimization problem.  The simplest solution of just
making background-color work just like the other properties (which we
can't do anymore anyway) would be very inconvenient in the vast
majority of cases.  A more complicated solution making
background-color "do the right thing" when you give a single color
would be inconsistent with the rest of the language, and thus hard to
learn.  Instead, we hacked around the issue and created ways of
producing solid-color images, which is a simple way to solve your
reasonably rare case.  It's not perfect, but it's the least bad of the
solutions (in our judgement).

~TJ

Received on Tuesday, 28 February 2012 15:58:02 UTC