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

Float left

My code will not fall into two collumns like i need it to but rather it just floats to the left of the screen. My css is correct so here is my html. The pictures that need to be floated are in the gallery ID. Check for any problems please!!

<!DOCTYPE html>
<html>
    <head>
      <meta charset="utf-8">
  <title>
    Benaiah Varner
  </title>
      <link rel="stylesheet" href="css/normalize.css">
      <link href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700,800|Changa+One' rel='stylesheet' type='text/css'>
            <link rel="stylesheet" href="css/main.css">

  </head>  
<body>
  <header>
  <a href="index.html"  id="logo">
  <h1>Benaiah Varner</h1>
  <h2>11 year old.</h2>
    </a>
    <nav>
      <ul id="green">
        <li><a href="index.html">Portfolio</a></li>
        <li><a href="about.html">about</a></li>
        <li><a href="Contact.html">Contact</a></li>
      </ul>
    </nav>
    </header>
    <div id="wrapper">
     <section>
        <ul id="gallery">
           <li>
              <a href="img/numbers-01.jpg">
              <img src="img/numbers-01.jpg" alt="">
               </a> 
                 <P>Exspirimentation with color and textures.</P>
                <a href="img/numbers-02.jpg">
              <img src= "img/numbers-02.jpg" alt="">
                  </a>
                 <P>playing with blending modes in photoshop.</P>
                <a href="img/numbers-06.jpg">
              <img src="img/numbers-06.jpg" alt="">
                  </a>
                 <P>Trying to create a 80's style of glows.</P>
                <a href="img/numbers-09.jpg">
              <img src="img/numbers-09.jpg" alt="">
                  </a>
                 <P>drips using photoshop brushes.</P>
                <a href="img/numbers-12.jpg">
              <img src="img/numbers-12.jpg" alt="">
                  </a>
                 <P>Creating shapes using repition.</P>
           </li>
        </ul>
     </section>
      <footer>
         <a href="https://plus.google.com/u/0/117302655370136417616/posts"><img src="http://uofueclub.com/wp-content/uploads/2013/08/google-plus-logo.png"></a>
         <p>benaiahvarner@gmail.com</p>    
        &copy; 2014 Benaiah Varner
      </footer>
    </div>
 </body>
</html>
Tim Knight
Tim Knight
28,888 Points

Could you post your CSS too please? Since CSS controls your positioning of the objects on the screen that's likely going to be your culprit.

2 Answers

<li> means LIST ITEM, so, it's an <li> for each item, not all the itens inside only ONE li tag. The corret is

<ul>
 <li>
   <a>
    <img>
   </a>
 </li>
 <li>
   <a>
    <img>
   </a>
 </li>
 ...
</ul>
Jacob Sigman
Jacob Sigman
6,581 Points

You need to select the gallery in css like so...

gallery li {

float:left; width:45%; margin:2.5%; background-color:#f5f5f5; color:#bdc3c7;

}