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 trialAditi Jain
1,217 Pointsdrifting images of the gallery
When I did exactly as Nick told,
#gallery li:nth-child(4n) { clear: left; }
it worked fine. But when I increased the description of the first image by a few lines in index.html's gallery, the third and the fourth images drifted to the right hand side again at different browser window sizes.
P.S. the code is same as Nick's.
3 Answers
Alessandra Vaughn
13,915 PointsHi Aditi,
Are you having the issue when the images are 2 across and the width of the browser window is around 300-ish pixels wide? I have this issue as well. I don't think it was addressed in the video. I fixed it by adding an additional media query for a screen width of 479 pixels or less. See code below.
@media screen and (max-width: 479px) {
/* two-photo layout */
#gallery li {
width: 42.5%
}
#gallery li:nth-child(3n) {
clear: left;
}
}
Aditi Jain
1,217 PointsHi! Thanks for the code. It did fix the issue.Thanks for the idea! :)
Anyways, quick question: why did we make 2 column layout when we were fitting 3-images per row? Code is pasted below:
@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.3333%; } }
Alessandra Vaughn
13,915 PointsHi - I'm glad the code worked. I think that "two-column layout" code is for the contact page, not for the gallery.