Re: CSS3 missing selector

Dave Smith (2009-03-23):
> <section>
> <h1 or h>My section heading</h1 or h>
> <p>Para</p>
> <p>Para</p>
> </section>
>
> Given the above, to style the section content so that it is  
> indented by
> 20px, but leave the heading with no margin can be done with:

   section > *  {margin-left: 20px;}
   section > h1 {margin-left: 0;}
   /* CSS2 solution */

> section > *:not(h1) {margin-left:20px;}
   /* CSS3 solution */

> h1:content {margin-left:20px;}
> h1:section { }
   /* CSS4 solution proposed */

I am not sure this is the best way to do it, though.

In Microsoft Word and similar word processors sections are used, too  
(i.e. in the user interface and the native document format of the  
software). They are the entities differing page headers and footers  
(other than first, left and right differences) or column layouts can  
be applied to. There are two types of section, the first starts  
immediately at a (manual) section break and the second firstly  
generates a page break (possibly so that the section begins on a even/ 
left or odd/right page).
Maybe it makes sense to implement them akin to pages in CSS.

   section {section-break-before: always; section-break-after: always;}
   @section {counter-reset: chapter} /* etc.pp. */

As with pages there would be named sections. Can you put the  
<identifier> for |page| and |@page| inside quotation marks, by the  
way? (I like to differentiate predefined keywords and variable strings.)

In due time maybe there will be |:last|, |:nth()|, |:odd| and |:even|  
pseudo classes for both, sections and pages, to go along |:first|  
(and |:left| and |:right|), perhaps base upon the predefined 'page'  
counter. Note that 'odd' resp. 'even' is not (always) the same as  
'right' resp. 'left', so they might be useful for the |*-break-*|  
properties, too.

A section break should not imply a page break, you should have to set  
both properties:

   h1 {section-break-before: always; page-break-before: right;}

This would probably best fit into CSS Paged Media Module (whichever  
level). <http://www.w3.org/TR/css3-page/>, <http://dev.w3.org/csswg/ 
css3-page/>

Received on Thursday, 2 April 2009 11:22:54 UTC