Re: "::inside" Pseudo-Element

Ian Hickson wrote:
> On Fri, 30 Dec 2005, Daniel Schierbeck wrote:
> 
>>I often find myself using nested DIV tags when I write XHTML documents. 
>>That way I can position the "content" area of the document through CSS.
>>
>> ...
>> <body>
>>   <div id="wrap">
>>     <div id="header"/>
>>     <div id="nav"/>
>>     <div id="content"/>
>>     <div id="footer"/>
>>   </div>
>> </body>
>>
>> #wrap {
>>   width: 500px;
>>   margin: 50px auto;
>> }
>>
>>I want to be able to skip the #wrap element, since it adds neither semantics
>>nor structure to the document (it's the only child of the BODY element)
> 
> Why not style the <body> element directly?

I agree that in this case styling the <body> element is the right 
solution. However, there're cases where you really wanted to have 
::inside pseudo-element. And that's for cases where the backwards 
compatible styles go to the "real" element. For example, if I have a 
fragment like

...
<foo>
<a />
<b />
<c />
<d />
</foo>
<bar>
...
</bar>
...

And say I want to say

foo {display:table; width: 100%; height: 50%;}
foo::inside {display: table-cell; vertical-align: middle;}

And in case the UA doesn't support ::outside nor ::inside, I'd 
prefer it to use style
   {display:table; width: 100%; }
instead of
   {display: table-cell; vertical-align: middle;}

(I'm not sure where the automatically generated table elements go. I 
hope that foo and foo::inside are part of the same table above. The 
target is to make foo element to fill the parent element half full 
and have it's contents vertically centered. And as a fallback foo 
should still take the same amount of space but the content wouldn't 
be vertically centered. I use the table construct because CSS 2.1 
doesn't allow vertical-align in other block-level elements but 
table-cell elements. If I say foo {display:table-cell} I cannot use 
percentages to define the size of the element.)

For some constructs the most important style is in the outer element 
and if that's the pseudo-element, things can go seriously wrong with 
the older UAs. In short: I think that ::inside is required for a 
smooth transition to ::outside.

-- 
Mikko

Received on Monday, 2 January 2006 10:20:57 UTC