Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the document</title> <style> p:nth-last-child(odd) { background: #1c87c9; color: #eee; } p:nth-last-child(even) { background: #666; color: #eee; } </style> </head> <body> <h2>:nth-last-child selector example</h2> <p>Paragraph 1</p> <p>Paragraph 2</p> <p>Paragraph 3</p> </body> </html>