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 trialErnest Tidwell II
Courses Plus Student 6,658 Pointsresponsive.css 2 column mobile issue
when i shrink back to mobile size i still have 3 columns after i type the following code
gallery li {
width: 28.3333%
}
5 Answers
Ernest Tidwell II
Courses Plus Student 6,658 Pointsi figured it out! i had a curly bracket in the wrong place!
geoffrey
28,736 PointsIn such circumstances, It's always better to post a link to the website, to your project for example on codepen. Or here, this way we can help you easily.
Vadim Sh
2,037 Pointsi have the similar problem, but i checked brackets, and if i make browser smaller size, it would still three columns of image, unless two like for the mobile view,
Vadim Sh
2,037 PointsMaybe it's because the last rule for <li> from responsive.css doesn't cascade previous rule from 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.75 em; color: #bdc3c7; }
@media screen and (min-width: 480px) {
/******************
TWO COLUMN LAYOUT
***************/
#primary {
width: 50%;
float: left;
}
#secondary {
width: 40%;
float: right;
}
}
/***************
3 * 5%=15%
100%-15%=85%
85%/3=28.3%
***************/
/***************
PAGE:PORTFOLIO
******************/
gallery li {
width: 28.3333%; }
gallery li:nth-child(4n) {
clear: left; }