HTML CSS examples for CSS Selector:nth-child
Select <p> element that is the second child of its parent
<!DOCTYPE html> <html> <head> <style> p:nth-child(2) {<!-- w ww . j a va2 s . c o m--> background: red; } </style> </head> <body> <p>The first paragraph.</p> <p>The second paragraph.</p> <p>The third paragraph.</p> <p>The fourth paragraph.</p> </body> </html>