Jump to content

Targeting specific nth child

Recommended Posts

Hi everyone,

I figured that we could change specific elements within a class by using their nth child number (I'm not sure this sentence is correct I'm not still learning css). 

How do you go about finding the nth child number of an element? I tried looking everywhere using the inspect tool but didn't manage to figure this out.

Thank you in advance!

 

Link to comment
  • Replies 1
  • Views 1.8k
  • Created
  • Last Reply
<div class="tuan">
  <div class="b1"></div>
  <div class="b3"></div>
  <div class="b3"></div>
  <div class="b4"></div>
</div>

div b1 will have: .tuan div:nth-child(1)

div b2 will have .tuan div:nth-child(2)

div b3 will have .tuan div:nth-child(3)

...

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.