This works like this: the first-of-type selector actually selects the first of a specific element type (section, div, span, etc.) and does not actually select the first type of type.
Alternatives
Correction '~'
The tilde ' ~ "workaround is mentioned here .
p { display: block; clear: both; } #review div p { padding-top:10px; } #review div p:first-letter{ float: left; line-height:90%; padding-right: 15px; padding-bottom: 10px; font-family: "Georgia",_serif; font-weight: bold; font-size: 60px; color:black; } #review > div ~ div > p ~ p, #review > .content_left ~ .content_left p:first-of-type { padding-top: 0px; } #review > .content_left ~ .content_left p:first-of-type:first-letter, #review > div ~ div > p ~ p:first-letter { float: none; line-height:90%; padding-right: 0px; padding-bottom: 0px; font-family: "Georgia",_serif; font-weight: normal; font-size: 12px; }
Example using the ~ method
(Thanks to BoltClock for helping me along with this, and this is his method after all).
Div mode switching
Moving .content_right behind .content_right sections as they are floating and you can still support the same layout.
code:
<section id="review"> <div class="content_left"> <p>text</p> <p>text</p> </div> <div class="content_left"> <p>text</p> <p>text</p> </div> <div class="content_right"></div> </section>
Example switching order :
Using the nth-of-type selector
Use the :nth-of-type selector to select the correct div.
code:
#review .content_left:nth-of-type(2) :first-child { padding-top:10px; } #review .content_left:nth-of-type(2) :first-child:first-letter { float: left; line-height:90%; padding-right: 15px; padding-bottom: 10px; font-family: "Georgia",_serif; font-weight: bold; font-size: 60px; color:black; }
Example usage: nth-of-type
source share