W3C home > Mailing lists > Public > www-style@w3.org > December 2011

Re: [css3-background] Overly-clever background-position grammar

From: Christoph Päper <christoph.paeper@crissov.de>
Date: Tue, 20 Dec 2011 15:06:50 +0100
Message-Id: <9EC44D2A-0029-437A-9561-6FA387075104@crissov.de>
To: www-style list <www-style@w3.org>
>> <bg-position>  = [
>>   [ top | bottom ]
>> |
>>   [ <percentage> | <length> | left | center | right ]
>>   [ <percentage> | <length> | top | center | bottom ]?
>> |
>>   [ center | [ left | right ] [ <percentage> | <length> ]? ] &&
>>   [ center | [ top | bottom ] [ <percentage> | <length> ]? ]
>> ]

This allows “left top”,   “left bottom”,   “left center”, 
           “right top”,  “right bottom”,  “right center”,
          “center top”, “center bottom”, “center center”,
but forbids “top left”, “bottom left”,   “center left”,
           “top right”, “bottom right”,  “center right”,
          “top center”, “bottom center”. 
Is this intended?

Reformulations

unconventional:

<bg-position>  = [
  [ <percentage> | <length> | left | center | right ]? &&
  [ <percentage> | <length> | top | center | bottom ]?
|
  [ center | [ left | right ] [ <percentage> | <length> ]? ] &&
  [ center | [ top | bottom ] [ <percentage> | <length> ]? ]
]

reordered:

<bg-position>  = [
             [ top | bottom ]
|
  [ center |   left | right  |  <percentage> | <length>    ]
  [ center |   top | bottom  |  <percentage> | <length>    ]?
|
  [ center | [ left | right ] [ <percentage> | <length> ]? ] &&
  [ center | [ top | bottom ] [ <percentage> | <length> ]? ]
]

regrouped:

<bg-position>  = [
  [ center |   left | right  |
               top | bottom  |  <percentage> | <length>    ]
|
  [ center |   left | right  |  <percentage> | <length>    ] &&
  [ center |   top | bottom  |  <percentage> | <length>    ]
|
  [ center | [ left | right ] [ <percentage> | <length> ]? ] &&
  [ center | [ top | bottom ] [ <percentage> | <length> ]? ]
]

verbose, no redundancy:

<bg-position>  = [
  [ center |   left | right  |
               top | bottom  |  <percentage> | <length>   ]
|
  [ center |   left | right  |  <percentage> | <length>   ] &&
  [ center |   top | bottom  |  <percentage> | <length>   ]
|
  [          [ left | right ] [ <percentage> | <length> ] ] &&
  [ center | [ top | bottom ]                             ]
|
  [ center | [ left | right ]                             ] &&
  [          [ top | bottom ] [ <percentage> | <length> ] ]
|
  [          [ left | right ] [ <percentage> | <length> ] ] &&
  [          [ top | bottom ] [ <percentage> | <length> ] ]
]

compact verbose:

<bg-position>  = [
  [ center | left|right | top|bottom | <percentage>|<length> ]
|
  [ center | left|right | <percentage>|<length> ] 
  [ center | top|bottom | <percentage>|<length> ]
|
  [ [ left|right ] [ <percentage>|<length> ] [ center | top|bottom ] ]
|
  [ [ center | left|right ] [ top|bottom ] [ <percentage> | <length> ] ]
|
  [ [ left|right ] [ <percentage>|<length> ] [ top|bottom ] [ <percentage>|<length> ] ]
]

variant (by first token):

<bg-position>  = [
  [            [ left | right ]  [ <percentage> | <length> ]?
    [ center | [ top | bottom ]? [ <percentage> | <length> ]? ] ]
| 
  [ [ center                    |  <percentage> | <length> ]
    [ center | [ top | bottom ]? [ <percentage> | <length> ]? ] ]
|
  [            [ top | bottom ]  [ <percentage> | <length> ]?   ]
]

PS: Why again is the vertical center not called ‘middle’?
PPS: Procrastination sucks big time.
Received on Tuesday, 20 December 2011 14:07:22 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:47 GMT