Let's say that I have the following html:
<div class="container">
<p>...</p>
<div>...</div>
<ol>...</ol>
<p>...p</p>
</div>
I would like to apply style to the last element inside the container
class. In the example above I would like to apply margin-bottom
to the last <p>
. Keep in mind that the last element is not always <p>
, it could be anything.
I tried with
.container:last-child {
margin-bottom: 0px;
}
but the style wasn't applied. Could someone point me in the right direction please?