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

Re: "::inside" Pseudo-Element

From: Mikko Rantalainen <mikko.rantalainen@peda.net>
Date: Mon, 02 Jan 2006 12:20:35 +0200
Message-ID: <43B8FE73.4020807@peda.net>
To: www-style@w3.org

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

<a />
<b />
<c />
<d />

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.

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

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:22 UTC