<html>
<head>
<style>
li:last-child {
background-color: blue;
color:white;
}
p:last-child {
color: orange;
text-align: center;
}
div {
padding:5px;
width:auto;
border:1px solid red;
}
</style>
</head>
<body>
<p> Example for CSS pseudo class :last-child property</p>
<ul>
<li>Mango</li>
<li>Orange</li>
</ul>
<ol>
<li>Jasmine</li>
<li>Rose</li>
</ol>
Note: In list items Orange and Rose are last-child of ul and ol tags
<p>This property styles the last child of each parent element</p>
<div>
<p>Paragraph 1</p>
<p>Paragraph 2</p>
<p>Paragraph 3</p>
</div>
</body>
</html>