问题
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 work on everything or not. Thanks
回答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;
}
<div class="box">First row</div>
<div class="box">second row</div>
<div class="box">third row</div>
<div class="box">fourth row</div>
来源:https://stackoverflow.com/questions/60789227/does-alternate-row-color-works-only-for-table-or-for-any-other-tag-ex-div