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

HTML How to Make a Website Styling Web Pages and Navigation Make a CSS Image Gallery

Paul Nam
Paul Nam
2,093 Points

The quiz keeps saying "be sure to float the gallery list items to the left" and set width to 45%. Where did i mess up?

a { text-decoration: none; }

wrapper {

max-width: 940px; margin: 0 auto; }

logo {

text-align: center; margin: 0; }

h1, h2 { color: #fff; }

nav a { color: #fff; }

nav a:hover { color: #32673f; }

h1 { font-family: Changa One, sans-serif; font-size: 1.75em; font-weight: normal; }

img { max-width: 100%; }

gallery {

float: center; margin: 0; padding: 0; width: 0; list-style: none; }

gallery li {

float: left; width: 45%; }

css/main.css
a {
  text-decoration: none;
}

#wrapper {
  max-width: 940px;
  margin: 0 auto;
}

#logo {
  text-align: center;
  margin: 0;
}

h1, h2 {
  color: #fff;
}

nav a {
  color: #fff;
}

nav a:hover {
  color: #32673f;
}

h1 {
  font-family: Changa One, sans-serif;
  font-size: 1.75em;
  font-weight: normal;
}

img{
  max-width: 100%;
}

#gallery {
  float: center;
  margin: 0;
  padding: 0;
  width: 0;
  list-style: none;
}

#gallery li {
  float: left;
  width: 45%;
}

2 Answers

Shawn Ramsey
Shawn Ramsey
27,237 Points

The css for the gallery li is correct. However, the previous question asks you to "Select the element with the ID gallery. Then, remove the margin, padding, and bullet points.". You have that mostly correct by setting your margin to 0, your padding to 0 and your list-style to none. There is no reason to float to the center or have a width of 0. By adding that unnecessary code, it's possible that it is causing the next question to render incorrect even though it is correctly written.

This would get that part of the code correct.

#gallery {
    margin: 0;
    padding: 0;
    list-style: none;
}

The code you wrote for gallery li is correctly written.

#gallery li {
    float: left;
    width: 45%;
}
Paul Nam
Paul Nam
2,093 Points

Oh my god, thank you! i was stuck re-watching the entire lesson LOL! thank you SO MUCH

Shawn Ramsey
Shawn Ramsey
27,237 Points

You're welcome. Glad I could help. :)