in code below i try to make last child of p elements color to red but don't work, but first child by :first-child pseudo element work. in this case last child of div element would be to color red, but last child of body wouldn't.
`
p:last-child {
color: red;
}
<body>
<p>Lorem, ipsum.</p>
<p>Lorem, ipsum.</p>
<p>Lorem, ipsum.</p>
<div>
<p>Lorem, ipsum.</p>
<p>Lorem, ipsum.</p>
<p>Lorem, ipsum.</p>
</div>
<p>Lorem, ipsum.</p>
<p>Lorem, ipsum.</p>
<p>Lorem, ipsum.</p>
</body>
`