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

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

Jack Zumwalt
Jack Zumwalt
1,344 Points

White space surrounding header not removed

Hello, I've been dealing with this problem for a minute and scanned the questions but have failed to come up with a correct answer. I have copied what Nick told us to do and the top, left, and right is still not filled in. What am I doing wrong?

Jack Zumwalt
Jack Zumwalt
1,344 Points
header {
  float: left;
  margin: 0 0 30px 0;
  padding: 5px 0 0 0;
  width: 100%;
}

can u paste your complete code with HTML because this is not enough to find out the reason for the problem...!

may be it is because of the h1 margin

4 Answers

david mcque
david mcque
2,963 Points

i had the same problem for me it seemed to be the normalise.css wasn't quite doing its job. I replaced it with the following: -

/* CSS reset */
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td { 
    margin:0;
    padding:0;
}
html,body {
    margin:0;
    padding:0;
}
table {
    border-collapse:collapse;
    border-spacing:0;
}
fieldset,img { 
    border:0;
}
input{
    border:1px solid #b0b0b0;
    padding:3px 5px 4px;
    color:#979797;
    width:190px;
}
address,caption,cite,code,dfn,th,var {
    font-style:normal;
    font-weight:normal;
}
ol,ul {
    list-style:none;
}
caption,th {
    text-align:left;
}
h1,h2,h3,h4,h5,h6 {
    font-size:100%;
    font-weight:normal;
}
q:before,q:after {
    content:'';
}
abbr,acronym { 
    border:0;
}
Dujoh Ollivierre
Dujoh Ollivierre
1,852 Points

This solution works, but what does that mean for the normalize.css file that is given to us during the lesson then.

Kevin Faust
Kevin Faust
15,353 Points

i dont know what is inside your header html, but if you have any h1 tags inside it, make sure to make its margin and padding set to 0

Jack Zumwalt
Jack Zumwalt
1,344 Points

I just tried changing my margin and padding to 0 in h1 and it still didn't work

Here's my header:

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: 0;
  padding-top: 0;
  font-size: 1.75em;
  font-weight: normal;
  line-height: 0.8ems;
}

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

Hi Jack

Not to sound like a broken record but can you please provide your html, your css seems to be fine but it would help more if you we could see what you html looks like.

Thank you

Annand Ramsahai
Annand Ramsahai
3,302 Points

Hi there, I'm having the same issue.

Here's what my html looks like:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>annand</title>
    <link rel="stylesheet" href="css/normalize.css">
     <link href='https://fonts.googleapis.com/css?family=Sanchez' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="css/main.css">
  </head>

  <body>
    <header>
      <a href="index.html" id="logo">
        <h1>annand</h1>
      </a>
        <nav>
          <ul>
            <li><a href="index.html" class="selected">Home</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>
        <p>This is a section.</p>
        <ul id="gallery">
          <li>
            <a href="img/numbers-01.jpg">
              <img src="img/numbers-01.jpg" alt="">
              <p>Experimentation with color and texture.</p>
            </a>  
          </li>        
          <li>
            <a href="img/numbers-02.jpg">
              <img src="img/numbers-02.jpg" alt="">
              <p>Playing with blending modes in photoshop.</p>
            </a>  
          </li>
          <li>
            <a href="img/numbers-06.jpg">
              <img src="img/numbers-06.jpg" alt="">
              <p>Trying to create 80s style of glows.</p>
            </a>  
          </li>
          <li>
            <a href="img/numbers-09.jpg">
              <img src="img/numbers-09.jpg" alt="">
              <p>Drips creating using photoshop brushes.</p>
            </a>  
          </li>
          <li>
            <a href="img/numbers-12.jpg">
              <img src="img/numbers-12.jpg" alt="">
              <p>Creating shapes using repetition.</p>
            </a>  
          </li>        
        </ul>
      </section>
    </div>
    <footer>
      <a href="http://www.twitter.com/aramsahai" target="_blank"><img src="img/twitter-wrap.png" alt="Twitter logo"></a>
      <p>&copy; 2016 annand</p>
    </footer>
  </body>
</html>