Easiest way to alternate row colors in PHP/HTML?

前端 未结 19 1899
無奈伤痛
無奈伤痛 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:29

    If you want to do it on the display end and are comfortable with or otherwise already using javascript, libraries like jQuery will often have :odd and :even selectors, which you can then hook up to adding specific style properties or hooking into CSS more generally by adding classes.

提交回复
热议问题