2015-01-02, 18:56, Tom Livingston wrote: [...]
<body class="foo"> <div class="main"> <div class="constrained"></div> <div class="two"><div class="constrained"></div></div> <div class="two"><div class="constrained"></div></div> <div class="two"><div class="constrained"></div></div> <div class="constrained"></div> </div> </body>and these styles: .foo .main .constrained:first-of-type{padding-bottom:0;} .foo .main .two:first-of-type{padding-top:0;}
[...]
I believe I've seen the error of my ways. Wasn't aware :first-of-type doesn't take applied classes into account, so the second :first-of-type rule above fails.
The second rule has no effect, since the selector in it matches no elements. The reason is that :first-of-type only matches an element that is a first child of its parent. Nothing else in a selector can change this. When you additionally use a class selector like .two, it simply imposes an additional restriction: the first child must also belong to the given class.
You probably wanted :first-of-class, but there is no such selector in CSS under any name, at present.
Yucca ______________________________________________________________________ css-discuss [[email protected]] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ List policies -- http://css-discuss.org/policies.html Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
