<!DOCTYPE html>
<html lang="en-US">
<head>
<style>
p:last-child{
color: red;
}
div{
border: 1px solid #8c8c8c;
margin:15px 0;
}
</style>
</head>
<body>
<h1>CSS :last-child Selector</h1>
<div>
<p>This is paragraph and last child of its parent (div).</p>
</div>
<div>
<p>This is paragraph but NOT a last child of its parent (div).</p>
<a href="#">I'm last child of this div.</a>
</div>
<p>This is paragraph and last child of its parent (body).</p> </body>
</html>