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