Front end: Even and odd rows in the table show different background colors

Method:  :nth-child(n) selector

The selector matches the nth child element belonging to its parent element, regardless of the element type.

n can be a number, keyword, or formula.

Use: 2n for even rows

table tr:nth-child(2n) {background-color: #f7f7f7;} 

Guess you like

Origin blog.csdn.net/weixin_38676276/article/details/107462138