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

HTML How to Make a Website Responsive Web Design and Testing Build a Three Column Layout

Douglas Walker
Douglas Walker
2,608 Points

[SOLVED] Need help, gallery not breaking down from 3 columns to 2.

Need help,

When adding three column layout on my portfolio page the images do not break down neatly into two columns when I shrink my browser page...

my code on responsive.css

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

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

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

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

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

gallery li {

width: 28.3333333%; }

gallery li:ntd-child(4n) {

clear:left; }

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

}

Have I missed something out with an img margin somewhere?

Here is the portfolio page on main.css

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

gallery {

margin: 0; padding: 0; list-style: none; }

gallery li{

float: left; width: 45%; margin: 2.5%; background-color: #f5f5f5; color: #bdc3c7; }

gallery li a p{

margin: 0; padding: 5%; font-size: 0.75em; color: #bdc3c7; }

Thanks,

Douglas Walker
Douglas Walker
2,608 Points

Just figured out the problem, had a misplaced curly brace :P

1 Answer

Sam Baines
Sam Baines
4,315 Points

Hi Douglas - Im not sure if this answers your question but you need to check some of your code for spelling mistakes and then apply the code correction from the teachers notes at the bottom of the video.

/* Your incorrect code */
gallery li:ntd-child(4n) {
     clear:left;
 }

gallery li:nth-child(3n+1) {
     clear:left;
 }

Hope this helps.

Douglas Walker
Douglas Walker
2,608 Points

Hi Sam, thanks for your answer. The problem was I accidentally closed the first @media query before adding this code! Thanks for also pointing out the need to improve the ntd code.

Best,