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!

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


My images are not horizontaly aligned

I am writing step by step with Lesson "How to make Web Site", but i use for the Gallery photos i've made. On second row one is collapsed with around 2 cm, on the 4th row - whole length and move to the right. If you see the problem, please tell me. Thank you very much.


2 Answers

Daniel Pitulia
Daniel Pitulia
5,388 Points

Hello, Veselina!

I found an extra <li> element in your html markup which was causing issues. I also added a css property called clear: both to one image which was still not aligned. This solution might be a bit outside the scope of that lesson. Anyway, this seems to make the images align horizontally:

<!DOCTYPE html>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="css/normalize.css">
     <link href='https://fonts.googleapis.com/css?family=Covered+By+Your+Grace' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Nunito:400,300' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="css/main2.css">

     <a href="index.html" id="logo">
       <h2>The German Spitz</h2>

         <li><a href="index.html" class="selected">Daily Routine</a></li>
         <li><a href="about.html">About</a></li>
         <li><a href="tips.html">Tips</a></li>
    <div id="wrapper">
        <ul id="gallery">
          <a href="img/FelixUpper.jpg">
            <img src="img/FelixUpper.jpg" alt="Hello World">
            <p>In the Upper garden for a first time</p></a>
          <a href="img/FelixHi.jpg">
            <img src="img/FelixHi.jpg" alt="Hello">
            <p>Hello, my name is Felix</p></a>
          <li style="clear: both;">
          <a href="img/Felix.jpg">
            <img src="img/Felix.jpg" alt="Hello World">
            <p>Hello World</p></a>
          <li><img src="img/FelixLeft1.jpg" alt="">
            <p>Dog to the left</p>
            <a href="img/Felix16.jpg">
            <img src="img/Felix16.jpg" alt="">
            <p>The Invisible</p></a>
            <a href="img/Felix17.jpg">
            <img src="img/Felix17.jpg" alt="">
            <p>Stay calm, Lady</p></a>
            <a href="img/Felix61.jpg">
            <img src="img/Felix61.jpg" alt="">
            <p>Starting a wide yawn</p></a>
            <a href="img/Felix12.jpg">
           <img src="img/Felix12.jpg" alt="">
            <p>Interesring dogs i met here</p></a>
        <a href="http://facebook.com/Felix40"><img src="img/facebook-wrap.png" alt="for congrats and presents" class="social"></a>
        <a href="http://twitter.com/myOwnerVF"><img src="img/twitter-wrap.png" alt="for complaints" class="social">
        <p>&copy;  2016 Felix</p>

Thanks a lot, Daniel, Now all is correct! Regards