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 How to Make a Website Responsive Web Design and Testing Refactor the Layout

Ginger Tech
PLUS
Ginger Tech
Courses Plus Student 5,566 Points

Hey, I cannot get past this code challenge. This is my code #gallery li { width: 28.3333%; }

Hey, I cannot get past this code challenge.

This is my code #gallery li { width: 28.3333%; }

I see nothing wrong with it at all...

css/main.css
@media screen and (min-width: 480px) {
   #primary{
       width: 50%;
       float: left;
   }
    #secondary {
        width: 40%;
        float: right;
    }
    #gallery li {
        width: 28.3333%;
    }
     #gallery li:nth-child(4n) {
        clear: left;
    }
    .profile-photo {
        float: left;
        margin: 0 5% 80px 0;
    }
}

@media screen and (min-width: 660px) {
    nav {
        background: none;
        float: right;
        font-size: 1.125em;
        margin: 5%;
        text-align: right;
        width: 45%;
    }

    #logo {
        float: left;
        margin-left: 5%;
        text-align: left;
        width: 45;
    }
    h1 {
        font-size: 2.5em:
    }
    h2 {
        font-size: 0.825em;
        margin-bottom: 20px;
    }

    header {
        border-bottom: 5px solid #599a68;
        margin-bottom: 60px;

    }
}

4 Answers

Ginger Tech
PLUS
Ginger Tech
Courses Plus Student 5,566 Points

managed to fix it with this code if anyone has a problem.

@media screen and (min-width: 480px) {

    #primary {
       width: 50%;
       float: left;
   }

    #secondary {
        width: 40%;
        float: right;
    }

    #gallery li {
        width: 28.3333%;
    }

     #gallery li:nth-child(4n) {
        clear: left;
    }

    .profile-photo {
        float: left;
        margin: 0 5% 80px 0;
    }
}

@media screen and (min-width: 660px) {

    nav {
        background: none;
        float: right;
        font-size: 1.125em;
        margin: 5%;
        text-align: right;
        width: 45%;
    }

    #logo {
        float: left;
        margin-left: 5%;
        text-align: left;
        width: 45;
    }

    h1 {
        font-size: 2.5em;
    }

    h2 {
        font-size: 0.825em;
        margin-bottom: 20px;
    }

    header {
        border-bottom: 5px solid #599a68;
        margin-bottom: 60px;

    }
}
Fred Sites
Fred Sites
11,151 Points

For task one #gallery li { width: 28.3333%; } works fine for me which looks identical to what you have. Which task are you stuck on? Make sure all your indentation is clean, sometimes the challenges will say its wrong for little indentation issues (I see a couple in the media query code).

Fred Sites
Fred Sites
11,151 Points

This code passed both tasks for me, the only difference I see is a couple spaces in your code that mine doesn't have. You also have another media query that I do not. I'm not sure where it came from, maybe they updated since I completed the track or you added it?

@media screen and (min-width: 480px) {
  #gallery li {
    width: 28.3333%;
  }

  #gallery li:nth-child(4n) {
    clear: left;
  }

}
Ginger Tech
Ginger Tech
Courses Plus Student 5,566 Points

Cheers buddy, it was from when I was watching the tutorial, there was two media queries, one for 480px and for for above.

Ginger Tech
PLUS
Ginger Tech
Courses Plus Student 5,566 Points

Doesn't work for task one :( @media screen and (min-width: 480px) { #gallery li { width: 28.3333%; }

#gallery li:nth-child(4n) { clear: left; }