Re: ordering of background shorthand properties

On 2010-01-30 5:07 AM, info@use-affairs.com wrote:
> All our websites have recently become invalid. Seems that the validator
> has changed the order of the background shorthand properties
> "background-position" and "background-repeat".
>
> Example:
>
> A CSS statement like "background:#324553 url(images/header_bg.gif) 0
> 10px repeat-x;"
> leads to the following validator error:
> "Value Error : background Too many values or values are not recognized",
>
> The same CSS statement, only with background-position and
> background-repeat swapped,
> "background:#324553 url(images/header_bg.gif) repeat-x 0 10px;"
> validates to XHTML 1.0 strict.

Both of the following code blocks validate for me in the release [1] and 
development [2] versions of the CSS validator:

* { background:#324553 url(images/header_bg.gif) 0 10px repeat-x; }
* { background:#324553 url(images/header_bg.gif) repeat-x 0 10px; }

Perhaps there was some other issue?

(Also curious how CSS code validated as XHTML 1.0 Strict; those are two 
distinctly different languages.)

> I wasn't aware that W3C Standards restrict the ordering of shorthand
> properties, especially since I never got an error nor a warning. Could
> it possibly be a validator bug?

According to the CSS3 Backgrounds and Borders Editor's Draft [3], there 
is no order unless |background-size| and |background-position| are both 
specified and then only for those two properties as a unit. (You didn't 
specify the former property so this wouldn't apply.)

[1] http://jigsaw.w3.org/css-validator/
[2] http://qa-dev.w3.org:8001/css-validator/
[3] http://dev.w3.org/csswg/css3-background/#the-background

Received on Monday, 1 February 2010 06:09:13 UTC