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

CSS How to Make a Website Styling Web Pages and Navigation Style the Portfolio

Myles Hyson
Myles Hyson
8,853 Points

When I shrink browser there is a blank space in row 2 column 1 of gallery. How do I fix that?

All the pictures are present, but instead it being a row of 2, row of 2, and one one the bottom, the first two pictures align fine, and in the second row there is 1 picture with a gap in the first column, and then 2 pictures on the bottom row.

Myles Hyson
Myles Hyson
8,853 Points

Here is my code.

/************************************ General *************************************/

body { font-family: 'Droid+Sans', sans-serif; }

wrapper {

margin: 0 auto; max-width: 940px; padding: 0 5%; }

a { text-decoration: none; }

img { max-width: 100%; }

/************************************ Heading *************************************/

logo {

text-align:center; margin: 0; }

h1{ font-family: 'Roboto', sans-serif; margin: 15px 0; font-size: 2em; font-weight: normal; line-height: 0.75em; }

h2 { font-family: 'Droid+Sans', sans-serif; font-size: 1em; font-weight: normal; margin: -5px 0 0; }

/************************************ Navigation *************************************/ nav { text-align: center; padding: 10px 0; margin: 20px 0 0; }

/************************************ Footer *************************************/ footer { font-size: .75em; text-align: center; padding-top: 50px; color: #ccc; clear:both; }

/************************************ Page: Portfolio *************************************/ #gallery { margin: 0px; padding: 0px; list-style: none; }

gallery li {

float: left; width: 45%; margin: 2.5%; }

/************************************ Colors *************************************/

/Website Body/ body { background: #fff; color: #999; }

/Red Header/ header { background: #BC3636; border-color: #BCB536; }

/Logo Color/ h1, h2 { color: #fff; }

/Navigation Background on mobile/ nav { background: #BCB536; }

/Nav links/ nav a, nav a:visited { color: #fff }

/Nav links selected/ nav a.selected, nav a:hover { color:#6E1A1A; }

1 Answer

try something like,

gallery li:nth-child(3n) {
clear:both
}