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 trialJeremy Whyte
830 PointsI have 4 images and I'm still having the same problems with lines wrapping and images not clearing
I have 4 images and I'm still having the same problems with lines wrapping and images not clearing. When I am looking it as a 3-column layout, it seems fine. However, when I resize my browser to where it's small enough that it adjusts to a 2-column layout, I'm again having the same wrapping problem. Is there a way to fix this?
Jeremy Whyte
830 PointsHi Martina,
Thanks so much for the reply!
Here's the codepen link to my HTML: http://codepen.io/jtw2114/pen/KwxNeN.html Here's the codepen link to my CSS which has the mainv3 and responsive css files: http://codepen.io/jtw2114/pen/KwxNeN.css
3 Answers
Chyno Deluxe
16,936 PointsI think this is what you needed. You had your responsive media queryies set to min-width instead of max-width and also you had your #gallery li % widths the other way. also the li:nth-child for the media query should have been set to (3n) so that it creates a two column layout on mobile. Let me know if this is what you where looking to do.
/****MAINV3.CSS***/
/*****
General
*****/
body {
font-family: 'Hind', sans-serif;
}
#wrapper {
max-width: 940px;
margin: 0 auto;
padding: 0 5%;
}
a {
text-decoration: none;
}
img {
max-width: 100%;
}
h3 {
margin: 0 0 1em 0;
}
/*****
HEADING
*****/
header {
float: left;
margin: 0 0 30px 0;
padding: -5px 0 0 0;
width: 100%;
}
#logo {
text-align: center;
margin: 0;
}
h1 {
font-family: 'Quattrocento Sans', sans-serif;
margin: 15px 0;
font-size: 1.75em;
font-weight: normal;
line-height: 0.8em;
}
h2 {
font-size: 1.25em;
margin: -5px 0 0;
font-weight: normal;
}
/*****
Navigation
*****/
nav {
text-align: center;
padding: 10px 10px;
margin: 20px 0 0;
}
nav ul {
list-style: none;
margin: 0 10px;
padding: 0;
}
nav li {
display: inline-block;
}
nav a {
font-weight: 700;
padding: 15px 10px;
}
/*****
footer
*****/
footer {
font-size: 0.75em;
text-align: center;
clear: both;
padding-top: 50px;
color: #ccc;
}
.social-icon {
width: 20px;
height: 20px;
margin: 0 5px;
}
/*****
Page Theory
*****/
#gallery {
margin: 0;
padding: 0;
list-style: none;
}
#gallery li {
float: left;
width: 28.3333%;
margin: 2.5%;
background-color: #f5f5f5;
color: #bdc3c7;
}
#gallery li a p {
margin: 0;
padding: 5%;
font-size: 1.0em;
color: #bdc3c7;
}
/*****
Page Paper
*****/
.profile-photo {
display: block;
max-width: 300px;
margin: 0 auto 30px;
}
/*****
Page Motion
*****/
.linksout {
list-style: none;
padding: 0;
margin: 0;
font-size: 0.9em;
}
.linksout a {
display: block;
min-height: 20px;
background-repeat: no-repeat;
background-size: 20px 20px;
padding: 0 0 0 30px;
margin: 0 0 10px;
}
.linksout li.Treehouse a {
background-image: url('../img/treehouse.png');
}
.linksout li.MLT a {
background-image: url('../img/mlt.jpg');
}
/*****
COLOR
*****/
/*site body*/
body {
background-color: #fff;
color: #999;
}
/*blue header*/
header {
background: #75D1FF;
border-color: #75D1FF;
}
/*mobile device nav background*/
nav {
background: #5292B2;
}
/*logo text*/
h1,
h2 {
color: #fff;
}
a {
color: #009933;
}
/*nav link*/
nav a,
nav a:visited {
color: #fff;
}
/*nav slelected link*/
nav a.selected,
nav a:hover {
color: #BBBBBA;
}
/****RESPONSIVE.CSS***/
@media screen and (max-width: 480px) {
/*****
Two Column Layout
*****/
#primary {
width: 50%;
float: left;
}
#secondary {
width: 40%;
float: right;
}
/*****
Page: Portfolio/Index
*****/
#gallery li {
width: 45%;
}
#gallery li:nth-child(3n) {
clear: left;
}
}
Jeremy Whyte
830 PointsHi Martina,
Thanks so much for the feedback. It didn't get me 100% of the way there but it got me thinking in the right direction and I got the problem resolved. Thanks again!
Jeremy
Chyno Deluxe
16,936 PointsLol its Martin but im glad i could help put you in the right direction.
Jeremy Whyte
830 PointsSorry about that! Not sure why I made that mistake twice.
Chyno Deluxe
16,936 PointsChyno Deluxe
16,936 PointsCan you please post your HTML and CSS.