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

Task 1 no longer working after I followed challenge's instructions to clear img float

Well I went over the video's multiple times and have a clear concept of how these advanced selectors work but I think I'm doing something wrong when pairing them up with simple css commands.

I'm having a problem with this challenge, can you point it out to me and explain why I keep getting an error? Thanks so much for the help.

style.css
/* Write the CSS in the media query below */

@media (min-width: 607px) {

  img { 
   clear: left;
  }

 img:nth-child(3n+4) {

  }
  }






}
index.html
<!DOCTYPE html>
<html>
<head>
    <title>Selectors</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="page.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
    <img src="thumb-forest.jpg" alt="">
    <img src="thumb-resort.jpg" alt="">
    <img src="thumb-trees.jpg" alt="">
    <img src="thumb-falls.jpg" alt="">
    <img src="thumb-view.jpg" alt="">
    <img src="thumb-sunset.jpg" alt="">
    <img src="thumb-lake.jpg" alt="">
    <img src="thumb-beach.jpg" alt="">
    <img src="thumb-bay.jpg" alt="">
    <img src="thumb-peaks.jpg" alt="">
    <img src="thumb-falls.jpg" alt="">
    <img src="thumb-resort.jpg" alt="">
</body>
</html>

1 Answer

Steven Parker
Steven Parker
231,236 Points

Task 1 says that the "rule that targets img elements" should "float the images left". So instead of "clear" it should have the "float" property.

The "clear" property should be inside the new rule with the pseudo-class selector added for task 2 (which is currently empty). Also, there seems to be a stray extra close brace after that rule.

Thanks Steven, I see I had to leave the first rule alone in this case. I'm going to have to look at it a bit more to understand how it works. Thanks so much for helping me!

Steven Parker
Steven Parker
231,236 Points

Generally, with multi-task challenges, each task will be added to the last. Unless they specifically instruct otherwise, each task will remain as-is when the following ones are done.