Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>last-of-type pseudo class</title> </head> <body> <style> main :last-of-type { background-color: aqua; } </style> <main class="example-wrapper"> <div>I'm the first div inside the main tag!</div> <div>Hi, this is the second div here!</div> <p>I'm a p tag which is alone here! But hey, look at my color</p> <div>I'm the last div here, look at my color!</div> </main> </body> </html>