Answer the question
In order to leave comments, you need to log in
Why doesn't :nth-child() work?
I don't know why, but I can't access the nested div's children with :nth-child().
<div class="post_right-section">
<h5>18 oct</h5>
<div>
<h3>Startup ideas need to be funded</h3>
<p>By Khalil Uddin in Development</p>
<p>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
sed diam nonumy eirmod teduntlabore et dolore magna aliquyam
erat, sed diam voluptua. At vero eos et accusam et justo duo
dolores et erebum. Stet clita kasd gubergren, no sea takimata
sanctus est Lorem ipsum dolor sit am Lorem ipsum dolor sit
amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidulabore et dolore aliquyam erat, sed diam
</p>
<button>Read more</button>
</div>
</div>
div.post_right-section div:nth-child(1){
font-size: 50px;
}
Answer the question
In order to leave comments, you need to log in
:nth-child() - Locates one or more elements based on their position among a group of adjacent elements. Those. the original selector says we're changing the font-size to 50px on the element that's div at position 1 , but we have an h3 element at position 1 .
You need :nth-of-type()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question