Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML How to Make a Website Styling Web Pages and Navigation Build Navigation with Unordered Lists

I am not able to make width of my page 100%.


/************************************.html file******************************* **/ <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>teamtreehouse</title> <link rel="stylesheet" type="text/css" href="normalise.css"> <link href="https://fonts.googleapis.com/css?family=Changa+One|Open+Sans" rel="stylesheet"> <link rel="stylesheet" type="text/css" href="teamtreehouse.css"> </head> <body> <header> <a href="index.html" id="logo"> <h1>Nick Pettit</h1> <h2>Designer</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"> <li> <a href="image.jpg"> <img src="image.jpg" alt="zdv"> <p>experiment</p> </a> </li> <li> <a href="image1.jpg"> <img src="image1.jpg" alt="asc"> <p>experiment</p> </a> </li> <li> <a href="image2.jpg"> <img src="image2.jpg" alt="vzd"> <p>experiment</p> </a> </li> <li> <a href="image3.jpg"> <img src="image3.jpg" alt="svcdz"> <p>experiment</p> </a> </li> </ul> </section> </div> <footer> <a href="http://twitter.com/avinash"><img src="img/twitter.png" alt="logo" class="social-icon"></a> <a href="http://facebook.com/avinash"> <img src="img/facebook.png" alt="fb.logo" class="social-icon"></a> <p>© avinash</p> </footer>

</body> </html>

/*****************************.css file******************************/

/*********************** general ************************/

body{ font-family: 'Open Sans', sans-serif; }

wrapper {

max-width: 940px;
margin: 0 auto;
padding: 0 5px;
background-color: orange;

} a { text-decoration: none; } img { max-width: 100%;


/*********************** heading ************************/

header { float: left; margin: 0 0 30px 0; padding: 5px 0 0 0; width: 100%; }

logo {

text-align: center;
margin: 0;


h1 { font-family: 'Changa One', sans-serif; margin: 15px 0; font-size: 1.75em; font-weight: normal; line-height: .8em; }

h2 { font-size: 0.75em; margin: -5px 0 0; font-weight: normal; }

/*********************** navigation ************************/

nav { text-align: center; padding: 10px 0; margin: 20px 0 0; }

nav ul { list-style: none; margin: 0 10px; padding: 0; } nav li { display: inline-block; } nav a { font-weight: 800; padding: 15px 10px; }

/*********************** footer ************************/

footer { font-size: .75em; text-align: center; clear: both; padding-top: 50px; color: #ccc; } .social-icon { width: 20px; height: 20px; margin: 0 5px; }

/*********************** page: portfolio ************************/

gallery {

margin: 0;
padding: 0;
list-style: none;


gallery li {

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


gallery li a p {

margin: 0;
padding: 5%;
font-size: 0.75em;
color: #bdc3c7;


/*********************** colors ************************/

body { background-color: #fff; color: #999; }

header { background-color: #6ab47b; border-color: #599a68; } h1 , h2 { color: #fff; }

nav { background-color: #599a68; } nav a, nav a:visited { color: white; } nav a.selected , nav a:hover { color: #32673f; } body { background-color: #fff; color: #999; }

/plz find my mistake and assist me/

5 Answers

Carl-Kaspar Puhm
Carl-Kaspar Puhm
Front End Web Development Techdegree Student 8,692 Points

using the float property the classical html layout goes mad. so you need to use clearfix to fix it. i think this might be an issue.

add to your html:

<header class="clearfix">


<ul id="gallery" class="clearfix">

to the css add:

.clearfix {
  overflow: auto;


body {
  margin: 0;

read about clearfix on google search

Could you share your workspace? Right away I can see you have your wrapper max-width (maximum width) set to 940 pixels which means that your page with me at a maximum width of 940 pixels and no more but I am not sure if that is all that is affecting your page.

i want my header to be 100%, i have set the values but i can't make it. I am using sublime text how to share it.

plz help

Thank you dude it help me, i used the same code, but i removed the "/class="clearfix"**/" from <ul>,as when i used it, it was not showing any images. It is the best answer for my question. Thank you for the help. Hope we see more from you.