Re: [css3-backgrounds] Example XV inconsistent with prose of section 3.6

On 09/14/2010 02:17 AM, Brian Manthos wrote:
> What does
>  Background-position: left 17px center;
> serialize out as?
>
> "left 17px 50%"?
>
> That seems to collide with
> "If three or four values are given, then each<percentage>  or<length>  represents
> an offset and must be preceded by a keyword, which specifies from which edge the offset is given."
>
> Or are you saying center sometimes becomes 50% when serialized out, and sometimes doesn't?
>
> Actually...
> Background-position: center right 15px;
> ...is a better example because with the left example below you can get away with "17px 50%".

Let's take a look at the Computed Value section of the property definition:
   http://www.w3.org/TR/css3-background/#the-background-position

It says:

   # If one or two values are specified, for a <length> the absolute length,
   # otherwise a percentage. If three or four values are specified, two
   # pairs of a keyword plus a length or percentage.

Further down the definition of 'center' says:

   # Equivalent to ‘50%’ (‘left 50%’) for the horizontal position if the
   # horizontal position is not otherwise specified, or ‘50%’ (‘top 50%’)
   # for the vertical position if it is.

So your first example would compute to "left 17px top 50%" and
your second example would compute to "right 15px top 50%".

~fantasai

Received on Tuesday, 14 September 2010 18:32:46 UTC