W3C home > Mailing lists > Public > www-style@w3.org > March 2006

CSS3 Paged Media - Grammar incorrect

From: Mike Bremford <mike-css@bfo.co.uk>
Date: Tue, 28 Mar 2006 12:00:49 +0100
Message-Id: <F759BDA9-6F40-4587-926A-5573CB2AAFAA@bfo.co.uk>
To: www-style@w3.org

Hi all

The grammar for the @page rule in CSS3 (at http://www.w3.org/TR/2004/ 
CR-css3-page-20040225/#syntax-page-selector) is slightly incorrect.  
The @page block is defined to be:

  PAGE_SYM S* IDENT? pseudo_page? S*
    '{' S* [ declaration | margin ] [ ';' S* [ declaration |  
margin ]? ]* '}' S*

and "margin" is

   margin_sym S* '{' declaration [ ';' S* declaration? ]* '}' S*

However this won't match constructs like

   @page {
     @top-left { this:that }   <---
     size: A4
   }

because a semi-colon would be required after the inner "}", where  
I've arrowed.

If I were to suggest a fix, I'd suggest ensuring the margin blocks  
came before any declarations, which would allow the rule to be  
rewritten as

  PAGE_SYM S* IDENT? pseudo_page? S*
    '{' S* margin* declaration? [ ';' S* declaration ]* '}' S*



On a related note, in CSS2.1 the grammar doesn't allow for a @page  
rule inside a @media rule, ie.

   @media print {
     @page { size:A4 }
   }

is disallowed. Is this deliberate?


Cheers... Mike
Received on Tuesday, 28 March 2006 11:00:55 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:44 GMT