Easiest way to alternate row colors in PHP/HTML?

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

    Just for fun

    Assuming you can use CSS3 selectors you can do something like

    Even with CSS2 support and mootools (javascript library) you can substitute the style with this javascript

    
    

    If you don't have anything but php a it you can simplify a bit yous code using an array

    
        

提交回复
热议问题