Forum Moderators: not2easy
<div id="my_style">
<div class="generic_row">
<div class="column_1_of_3">400px please - target THIS DIV only </div>
<div class="column_1_of_3">200 px</div>
<div class="column_1_of_3">200 px</div>
</div> <!-- closes .generic_row -->
<div class="clear_me"></div>
<div class="generic_row">
<div class="column_1_of_3">200 px</div>
<div class="column_1_of_3">200 px</div>
<div class="column_1_of_3">200 px</div>
</div> <!-- closes .generic_row -->
</div> <!-- closes #my_style --> div:first-child div.generic_row div:first-child {width: 400px; margin-right: 20px; float: left;}
body {width: 100%;}
div.generic_row {width: 1050px;}
.column_1_of_3 {width:200px; margin-right: 10px; float:left; border: 1px solid #ccc;}
.clear_me {clear: both;}
div:first-child div.generic_row div:first-child {width: 400px; margin-right: 20px; float: left;} .envelope > div:first-child > div:first-child "Why can't you add an id or class? Nested selectors can get messy very fast."
.envelope > div:first-child > div:first-child
I can't say that I UNDERSTAND it though
.envelope > div:first-child
.envelope > div:first-child > div:first-child
<div id="my_style">
<div class="generic_row">
<div class="column_1_of_3">400px please - target THIS DIV only </div>
<div class="column_1_of_3">200 px</div>
<div class="column_1_of_3">200 px</div>
</div> <!-- closes .generic_row -->
<div class="clear_me"></div>
<div class="generic_row">
<div class="column_1_of_3">200 px</div>
<div class="column_1_of_3">200 px</div>
<div class="column_1_of_3">200 px</div>
</div> <!-- closes .generic_row -->
</div> <!-- closes #my_style -->
.generic_row:first-child > .column_1_of_3:first-child
.generic_row:first-child > .column_1_of_3:first-child
div:first-child" is because the first element happens to be a DIV, so we don't have to specify "div:first-child", correct? .generic_row:first-child > .column_1_of_3:first-child
#my_style > div:first-child > div:first-child
something > otherthing something > otherthing > thirdthing [edited by: not2easy at 1:09 am (utc) on Nov 18, 2014]
[edit reason] popular request [/edit]
The reason you AREN'T using "div:first-child" is because the first element happens to be a DIV
<div id="my_style">
<div>
<h2>...</h2>
</div>
<div class="generic_row">
<div class="column_1_of_3">400px please - target THIS DIV only </div>
<div class="column_1_of_3">200 px</div>
<div class="column_1_of_3">200 px</div>
</div> <!-- closes .generic_row -->
<div class="clear_me"></div>
<div class="generic_row">
<div class="column_1_of_3">200 px</div>
<div class="column_1_of_3">200 px</div>
<div class="column_1_of_3">200 px</div>
</div> <!-- closes .generic_row -->
</div> <!-- closes #my_style -->
So for a "grandchild" selector to work, you need three pieces:
something > otherthing > thirdthing