HTML CSS examples for CSS Selector:nth-child
Using nth-child to style multiple items
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> ul li:nth-child(1), ul li:nth-child(3), ul li:nth-child(7), ul li:nth-child(8) { background-color:Chartreuse; color:yellow; } </style> <!-- ww w. j a v a 2 s . c om--> </head> <body> <ul> <li>L</li> <li>L</li> <li>L</li> <li>L</li> <li>L</li> <li>L</li> <li>L</li> <li>L</li> <li>L</li> </ul> </body> </html>