Skip to content Skip to sidebar Skip to footer

Does Alternate Row Color Works Only For Table Or For Any Other Tag Ex. Div

I have created rows without using a table since it was not cooperating with my Handlebars template and now want to have zebra stripe CSS, I want to know if that css property can wo

Solution 1:

Not necessary you can still use div to do the same job, something like below:

.box:nth-child(odd) {
    background: blue;
}
.box:nth-child(even) {
    background: yellow;
}
<divclass="box">First row</div><divclass="box">second row</div><divclass="box">third row</div><divclass="box">fourth row</div>

Post a Comment for "Does Alternate Row Color Works Only For Table Or For Any Other Tag Ex. Div"