I'm trying to use the zebra strip for my divs on my website, it sounds simple enough, however, I found that when I added the title between the lines of my divs, it seemed to count the title in an odd / clear style
HTML
<div class="container"> <h3>Title</h3> <div class="row">Content</div> <div class="row">Content</div> <h3>Title</h3> <div class="row">Content</div> <div class="row">Content</div> <div class="row">Content</div> <h3>Title</h3> <div class="row">Content</div> <div class="row">Content</div> <div class="row">Content</div> <div class="row">Content</div> </div>
CSS
.container { width:600px; margin:0 auto; } .row { line-height:24pt; border: solid 1px black; } .row:nth-child(odd) { background: #e0e0e0; } h3 { line-height:36pt; font-weight:bold; color:blue; }
fiddle
I would have thought that the code already in the fiddle would basically ignore the title and wrap the bar, but it seems like it treats the title as a child
html css zebra-striping
Andrew Morris Feb 21 '13 at 14:19 2013-02-21 14:19
source share