HTML CSS examples for CSS Selector:element parent child
use first-child selector for a certain class
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> div:first-of-type { background-color:Chartreuse; border:5px solid yellow; } .teste:nth-child(2) {<!-- w w w. j a v a 2 s. c o m--> background-color:blue; } </style> </head> <body> <div> Lorem ips </div> <div class="teste"> Lorem ips </div> <div class="teste"> Lorem ips </div> <div class="teste"> Lorem ips </div> </body> </html>