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

my webpage does not look like one taught in video..after applying the rules as taught in the video to the gallery ?

my images dont float well as shown in the video and description about the images are also scattered in my page..

here is my html code and css ''' <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Prashant Tiwari|beginer </title> <link rel="stylesheet" href="css/normalize.css"> <link href='http://fonts.googleapis.com/css?family=Changa+One|Open+Sans:400italic,400' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="css/main.css">

</head> <body> <header> <a href="index.html" id="logo" > <h1> Prashant</h1> <h2>Beginer</h2>

</a>

<nav>
  <ul>
    <li><a href= "index.html" class="selected" >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">
  <a href="img/numbers-01.jpg">
        <li><img src="img/numbers-01.jpg" alt="image of number 1"></li>
        <p> learning css and html</p>
        </a>
        <a href="img/numbers-02.jpg">
        <li><img src="img/numbers-02.jpg" alt="image of number "></li> 
        <p> MY favrouite pic</p>
        </a>
            <a href="img/numbers-06.jpg">
                <li><img src="img/numbers-06.jpg" alt=""></li>
                 <p> how is this?</p>
                </a>


        <a href="img/numbers-09.jpg">

              <li><img src="img/numbers-09.jpg" alt=""></li>
        <p> my favrouite number ;)</p>
        </a>
    </ul>  
  </section>

<footer>
<a href="https://www.facebook.com/sumiit.prashant"><img src="img/facebook-wrap.png" alt="facebook-logo"></a>
<a href="https://www.twitter.com/sumiit.prashant"><img src="img/twitter-wrap.png" alt="twitter-logo"></a>
<p>&copy; PKT 2015</p>
</footer>
</div>

</body> </html> ''''

this is my CSS code

''' /*********************************** GENERAL **************************************/ a { text-decoration:none; }

img{ max-width:100%; }

/*********************************** BODY *************************************/ body{ background-color:#fff; color: #999; font-family: 'Open Sans' ,sans-serif; }

/************************* div **************************/

wrapper {

max-width:940px; margin: 0 auto;

padding: 0 5%;

}

/************************** HEADING ***************************/ header { background: #6ab47b; border-color: #599a68; } header{ float:left;
margin: 0 0 30px 0; padding:5px 0 0 0; width:100% }

h1,h2{
color: #fff;
}

logo

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

a{ color: #6ab47b; } h1{ font-family:'Changa One', sans-serif; margin: 15px, 0; /* what is this ? / font-size: 1.75em; / em stands for emphasis and relativily font-size=1em is equal to 16pxs / font-weight: normal; /?*/ line-height:0.8em; }

h2{ font-weight:normal; margin : -5px 0 0; font-weight: normal;

}

/************************ NAVIGATION **************************/

nav  {
background: #599a68;
text-align:center;
padding: 10px 0;
margin: 20px 0 0;
}
nav a, nav a:visited { /*psuedo class */
color: #fff;
}

nav a.selected , nav a:hover {
color:#32673f;
}
/*********************************
FOOTER
*********************************/
footer{
font-size:0.75em;
clear:both;
text-align: center;
padding-top:50px;
color: #ccc;
} 


/*******************************
PORTFOLIO
******************************/




/***************************
UNORDERED LISTS
***************************/
#gallery{
list-style:none;
margin:0;
padding:0;
}

#gallery li {
margin:2.5%;
width: 45%;
background-color:#f5f5f5;
color:#bdc3c7;
float:left;
}
#gallery li a p {
margin:0;
padding:5%;
font-size:0.75em;
color: #bdc3c7;
} '''

! alt text

here is link scrrenshot of my webpage alt text

1 Answer

Hi, Your mistake is in the way that you built your list, you put this format:

<a href="img/numbers-01.jpg">
 <li><img src="img/numbers-01.jpg" alt="image of number 1"></li>
 <p> learning css and html</p>
</a>

When the right is:

<li>
  <a href="img/numbers-01.jpg">
   <img src="img/numbers-01.jpg" alt="image of number 1">
   <p>learning css and html</p>
  </a>
</li>

So to fix it, put this list inside your "ul":

<li>
  <a href="img/numbers-01.jpg">
   <img src="img/numbers-01.jpg" alt="image of number 1">
   <p>learning css and html</p>
  </a>
</li>
<li>
  <a href="img/numbers-02.jpg">
   <img src="img/numbers-02.jpg" alt="image of number "> 
   <p>MY favrouite pic</p>
  </a>
</li>
<li>
 <a href="img/numbers-06.jpg">
  <img src="img/numbers-06.jpg" alt="">
  <p>how is this?</p>
 </a>
</li>
<li>
 <a href="img/numbers-09.jpg">
  <img src="img/numbers-09.jpg" alt="">
  <p>my favrouite number ;)</p>
 </a>
</li>

: )

thanx a lot brother :)