HTML CSS examples for CSS Selector:nth-child
Using nth-child() non recursive
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> div {<!--from w w w.j a va 2 s . c o m--> background:white; } body>div:nth-of-type(1) { background:red; color:Chartreuse; } body>div:nth-child(2) { background:blue; } </style> </head> <body> <div> Lorem i </div> <div> Lorem i <div> Lorem ips </div> <div> Lorem ips </div> </div> </body> </html>