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 trialBen Carroll
3,201 Pointstext and images all on top of each other once window is made smaller
Hello I am trying to use the nth child command on my portfolio page but whenever I resize the window it seems to be all on top of one another
@media screen and (min-width:480px) {
/****************** TWO COLUMN LAYOUT ******************/
primary {
width: 50%;
float: left;
}
secondary {
width: 40%;
float: right;
} }
/****************** PAGE: PORTFOLIO ******************/
gallery {
width: 28.3333%;
}
gallery li:nth-child(4n) {
clear: left;
} @media screen and (min-width:660px) {}
and my main css page
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;
}
any help will be great :)
4 Answers
Miguel Palau
24,176 PointsDo you have a source page where I can see it live to help you.
Also did you do a clearfix?
Ben Carroll
3,201 Pointsno to both :(
Miguel Palau
24,176 PointsOk so first do a clearfix on the container of primary and secondary. Like this
.container:after {
content:"";
display:table;
clear:both;
}
Then comeback here to see if that helped
Ben Carroll
3,201 PointsI put #gallery li next to the width and it seems to have worked! but the 2nd image is still overlapping the text of the first image when the window is really small
Lennart Querter
11,533 PointsI change in the main.css
html <p>
.contact-info a {
display: block
}
</p>
to:
html <p>
.contact-info a {
display: inline-block
}
</p>