Easiest way to alternate row colors in PHP/HTML?

前端 未结 19 1931
無奈伤痛
無奈伤痛 2020-12-01 03:41

Here\'s a PHP example of mine. Can anyone find a shorter/easier way to do this?


    
19条回答
  •  眼角桃花
    2020-12-01 04:20

    Using CSS3 you can do something like this:

    div:nth-child(odd)
    {
      background-color: red
    }
    

    But better not use that for a few years if you actually want your users to see the color...

提交回复
热议问题