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

I can't get the images to float.

img {
  max-width: 100%;
}

/*************** 
Portfolio
***************/

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

#gallery li {
  float: left;
  width: 45%;
  margin: 2.5%;
  background-color: #f5f5f5;
  color: #bdc3c7;
}
<ul id="gallery">

Hi Yashvir,

What does it currently look like?

Can you post all the html for the "gallery" ul?

2 Answers

Griffin Byatt
Griffin Byatt
8,903 Points

To float an li element, make sure to display: block.

I've fixed it now, it turned out to be a problem in my HTML code there I repeated the <ul> element through out the list instead of just doing it once over all.