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

Select the list item float them to left and width of 45%. I have tried several different code type none of them work.

This is a code challenge that states select the list items nested inside the gallery. Float them to the left and set the width to 45%. Here is one of the codes that I have tried

gallery l1 {

float: left; width: 45%; } What is the challenge asking for

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

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

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


}
h1, h2 {
  color: #fff;
}
#gallery {
    float: left;
   padding: 0;
    margin: 0;
    list-style: none;

  }
 #gallery l1 {
  float: left;
  width: 45;

}
}
nav a {
  color: #fff;
}


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

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

6 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Cheri;

Welcome to Treehouse!

It looks like you have a number one (1) instead of an i in your gallery li selector.

Ken

Changed the code

gallery li {

float: left; width: 45%;

}

That is still not right what is the challenge asking for

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Cheri;

Are you indicating that gallery is an id with the # sign?

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

Happy coding,

Ken

Wayne Priestley
Wayne Priestley
19,579 Points

Hi Cheri,

You have a couple of extra closing brackets dotted about in your code, you also need to add a % to the end of width: 45;

Hope this helps.

Hi.

I have the same issue. I entered the following:

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

.. but it doesn't pass validation - it keeps saying "Bummer! Be sure to float the gallery list items to the left.".

This is exactly the same code that was shown in the video, and it worked when I typed it into my main.css whilst following the video.

Wayne Priestley
Wayne Priestley
19,579 Points

Hi Kevin,

It's best if you start a new question and past your html and css in it as it's easier to help you that way and more people will see your post.

Hope this helps.

Ok, thanks Wayne.