Re: [CSS21] Inheritance and first-line

On Sun, 23 Oct 2005, Boris Zbarsky wrote:
> 
> I'm looking at section 5.12.1 of CSS2.1, and I'm not quite sure what should
> happen with the following styles:
> 
> div { display: block; }
> div::first-line { display: table; color: red; }
> span { display: inherit; }
> 
> and the markup
> 
> <div><span>Text that fits on first line
> text that goes on second line</span></div>

Neither are we.


> Per the spec, the expected fictional tag sequence would be:
> 
> <div><div::first-line><span>Text that fits on first
> line</span></div::first-line>
> <span>text that goes on second line</span></div>

Note though that the fictional tag sequence is just an explanatory 
concept, and not an implementation requirement.


> So the display of the <span> will be "table", as I understand?  But then 
> this runs into the "The first line of a table-cell or inline-block 
> cannot be the first formatted line of an ancestor element" language.  
> So I'm a little at a loss as to what the resulting rendering should be.  

The language you mention doesn't affect this; an inline-table on the first 
line is still on the first line, it's only the cells inside that aren't 
considered to be. (It's saying ::first-line doesn't start drilling down 
past the first line box that it plays with, into other line boxes that 
might be indirectly in that line box.)


> In particular, which text, if any, should be red?  Should there be any 
> tables around?

What would you like the rendering to be? We're open to UA input here. 
CSS2.1 will probably never actually specify this, nor in all likelihood 
with the CSS Level 3 spec that covers this (Selectors), since they are 
both "finished". However, we should eventually define this.


> Note that I realize that the 'display' property need not "apply" to 
> ::first-line, but it's not clear what it means that the properties 
> "don't apply".  In particular, it's not clear whether this affects the 
> computed values of those properties or the used values...

What UAs generally seem to have done IIRC is made properties that normally 
inherit inherit from the ::first-line (and thus have two computed values, 
one for each part -- I'm not sure which they return for the DOM), and made 
properties that don't normally inherit inherit from the parent element.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Monday, 24 October 2005 03:57:33 UTC