HTML CSS examples for CSS Selector:nth-last-of-type
Select the second last <p> element within its parent counting.
<!DOCTYPE html> <html> <head> <style> p:nth-last-of-type(2) { background: red; } </style><!-- ww w .j a v a2 s. c om--> </head> <body> <p>The first paragraph.</p> <p>The second paragraph.</p> <p>The third paragraph.</p> <p>The fourth paragraph.</p> </body> </html>