Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Selectors Advanced Selectors :nth Pseudo-Class Challenge - Pt. 2

Angus Eliott
Angus Eliott
3,793 Points

what selector am I to use?

what is the selector that answers to the description "that selects a specific type of child element"

2 Answers

Franklyn Roth
Franklyn Roth
16,770 Points

The key word is 'type of child element' It could be :only-of-type, :last-of-type, :first-of-type the most specific would probably be :nth-of-type(n) where n is the child element number that you want to select.

Angus Eliott
Angus Eliott
3,793 Points

I've tried all of your suggested selectors Franklyn Roth and it gives me the same answer: Bummer! Are you using the pseudo-class that only targets a specific type of child element? My code beforehand:

/* Write the CSS in the media query below */

@media (min-width: 607px) {
  img {
    float: left;
  }
  img:nth-child(3n+4) {
   clear: left;
  }
}
Steven Parker
Steven Parker
231,248 Points

Franklyn is right, you need :nth-of-type here instead of :nth-child.

Are you sure you tried that?