HTML Editor
<!DOCTYPE html> <html lang="en-US"> <head> <style> p:nth-last-child(odd){ color: red; } p:nth-last-child(even){ color: blue; } </style> </head> <body> <h1>CSS :nth-last-child() Selector</h1> <p>This is 4th child (p) of its parent (body) from bottom.</p> <p>This is 3rd child (p) of its parent (body) from bottom.</p> <p>This is 2nd child (p) of its parent (body) from bottom.</p> <p>This is 1st child (p) of its parent (body) from bottom.</p> </body> </html>
OUTPUT
×

Save as Private