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

Why don't my gallery photos separate into three columns like Nick's do?

I feel as though I have the same code as Nick, but my gallery photos do not separate into three columns like Nick's - can anyone see what I'm doing wrong?

Here's a direct link to my code:

https://w.trhou.se/hz24k07jdm

Here's what I'm referencing specifically:

HTML:

 <section>
      <ul id="gallery">
        <li>
          <a href="img/numbers-01.jpg">
            <img src="img/numbers-01.jpg" alt="">
            <p>Experimentation with color and texture.</p>
          </a>
        </li>
        <li>
          <a href="img/numbers-02.jpg">
            <img src="img/numbers-02.jpg" alt="">
            <p>Playing with blending modes in Photoshop.</p>
          </a>
        </li>
        <li>
          <a href="img/numbers-06.jpg">
            <img src="img/numbers-06.jpg" alt="">
            <p>Drips created using Photoshop.</p>
          </a>
        </li>
        <li>
          <a href="img/numbers-09.jpg">
            <img src="img/numbers-09.jpg" alt="">
            <p>Drips created using Photoshop brushes.</p>
          </a>
        </li>
        <li>
          <a href="img/numbers-12.jpg">
            <img src="img/numbers-12.jpg" alt="">
            <p>Creating shapes using repetition.</p>
          </a>
        </li>
      </ul>
    </section>

CSS:

#gallery li {
  width: 28.3333%;
}

Thanks -

2 Answers

Hi ramseydennis,

You have 2 extra closing curly braces in your 480px media query.

Here's your css with some comments I added in:

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

  /************************
      TWO COLUMN LAYOUT
*************************/

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

  #secondary {
    width: 40%;
    float: right;
    }
  } /* This is extra, remove */

} /* This is extra, remove */

/************************
  3*5 = 15
100%-15%=85%
85/3= 28.333333333333333
*************************/

/************************
      PAGE: PORTFOLIO
*************************/

#gallery li {
  width: 28.3333%;
}

} /* This one closes off the 480px media query */

Great, thank you Jason. That worked -

Ernestas Sipavicius
Ernestas Sipavicius
6,327 Points

Try

#gallery li {
  width: 28.3333%;
  Float: left;
}