I am having an issue with the first-child selector in CSS. I have two divs with the same class, each containing an image and a paragraph element. When I use the .div-class:first-child {margin:10} rule, the margin is only applied to the paragraph in the first div.
My questions are: why is the margin not being added to the image (the first element in the div), and why is it only applying to the first div when both have the same class name?
<section class="section-offer">
<div class="section-offer-single">
<img src="images/pizza.png" alt="Pizza">
<p>Some text</p>
</div>
<div class="section-offer-single">
<img src="images/pizza.png" alt="Pizza">
<p>Some text</p>
</div>
</section>
.section-offer-single:first-child{
margin: 0px 0px 130px;
}