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 Make a CSS Image Gallery

Need solution to this problem: "Select the list items nested inside the gallery. Float them to the left."

THIS IS WHERE I'M CURRENTLY AT AND I WOULD LOVE SOME ADVICE OR GUIDANCE:

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: left; width: 45%; margin: 0; padding: 0; list-style: none;

}

4 Answers

Julian Gutierrez
Julian Gutierrez
19,201 Points

gallery is an id so it should use the "#" to select it. Also float left and 45% width need to be added to the list items inside of #gallery.

#gallery li{
  float:left;
  width:45%;
}
Dave Faliskie
Dave Faliskie
17,793 Points

because gallery is a class you are creating you have to have the '.' before it. you have to do this with logo and wrapper too. try

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: left; 
     width: 45%; 
     margin: 0; 
     padding: 0; 
     list-style: none;
}

I tried both Dave's & Julian's solution and it still does not work. What can possibly be the issue?

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 li{

 float: left; 
 width: 45%; 
 margin: 0; 
 padding: 0; 
 list-style: none;

}

Julian Gutierrez
Julian Gutierrez
19,201 Points

Your still missing a few things; to select the id wrapper, logo, and gallery you need a "#" mark. img also needs a max-height. Here is the correct code please look it over to see where your mistakes are.

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%;
  max-height:100%;
}

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

#gallery li{
 float:left;
  width:45%;
  margin:2.5%;
  color:white;
  background-color:black;
}