W3C home > Mailing lists > Public > www-style@w3.org > February 2010

Re: css3-background: grammar issue

From: Brad Kemper <brad.kemper@gmail.com>
Date: Tue, 23 Feb 2010 19:44:17 +0800
Cc: fantasai <fantasai.lists@inkedblade.net>, Bert Bos <bert@w3.org>, www-style@w3.org
Message-Id: <A0400717-019C-458A-8EBB-175EDEF47D20@gmail.com>
To: Yves Lafon <ylafon@w3.org>

On Feb 23, 2010, at 6:45 PM, Yves Lafon wrote:

>> - Change the token '/' to the keyword 'as'
>> - Replace
>>     # where ?<bg-position>? must occur before ?/ <bg-size>? if both are present.
>>   with
>>     | where '<bg-position>' must not occur immediately after 'as <bg-size>'
>> Would this address your concerns?
> Replacing '/' by 'as' will indeed help. The second rule was more an example that there were "more restrictive than necessary" rules and just adding one to forbid '/' being first was not out of the line. But the new wording, "must not occur immediately" will make it easier to check anyway, so OK for both.

This does not seem to me like the right thing to do. The arbitrary-seeming rule to disallow a slash+background-size at the beginning seems to me to be "more restrictive than necessary". The slash has been established elsewhere (such as in border-image) as a disambiguating divider, and that seems very clear to me; much more so than "as" as a disambiguating prefix word. When one thinks of 1-2 lengths or percentages as meaning 'background-size' when found anywhere after a slash, and as meaning 'background-position' otherwise, then it is very clear, and no further restrictions are needed. I think all the following should be equally valid, as all seem equally clear:

background: url(img.png);
background: 10% 90%;  /* bg-position */
background: / 10% 90%;  /* bg-size */
background: 10% 90% / 10% 90%; /* bg-position, then bg-size */

I think it would be confusing for authors to have to remember that for some reason they could not have just a bg-size as the singleton value for their shorthand just because it still required a slash to its left. And I really do not think it is improved by having "as" instead of "/" as the required text to its left. Of the following four choices, I much prefer the first:

background: / 10% 90%;  
background: as 10% 90%;  
background: size 10% 90%;  
background: some-other-text 10% 90%;  

As for this:

> background: url("foo.png") / 10em black 10em

...it just doesn't make any sense to me. The first 10em must be bg-size, because it is after the slash, but then there is a second 10em (separate, due to the 'black') after the slash too? How can that be interpreted as anything other than a mistake, when slashes are used to separate and group the values of the shorthand, same as in border-image?

Received on Tuesday, 23 February 2010 11:44:57 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:07:43 UTC