CSS div alternating colour

前端 未结 3 1692
醉话见心
醉话见心 2020-12-13 08:12

I\'m trying to zebra stripe my divs in my website, sounds simple enough, however I\'ve found that when I added a header in between the rows of my divs it seems to count the

3条回答
  •  时光取名叫无心
    2020-12-13 08:42

    You probably want to match on type, not child.

    Use :nth-of-type such as

    .row:nth-of-type(odd) {
        background: #e0e0e0;
    }
    

提交回复
热议问题