You can use the CSS3 :nth-child selector to highlight the background of alternate table row for creating a zebra-striped table. The :nth-child(N) pseudo-class accepts an argument N, which can be a keyword, a number, or a number expression of the form xn+y where x and y are integers (e.g. 1n, 2n, 3n, 2n+1, 3n-2, …). Try out the following example to see how it works:
Use the CSS
":nth-child"selectorYou can use the CSS3
:nth-childselector to highlight the background of alternate table row for creating a zebra-striped table. The:nth-child(N)pseudo-class accepts an argumentN, which can be a keyword, a number, or a number expression of the formxn+ywherexandyare integers (e.g.1n,2n,3n,2n+1,3n-2, …). Try out the following example to see how it works:output: