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 CSS Layout Basics Getting Started with CSS Layout Centering Page Content and Creating a Full-width Header

It seems my header isn't matching his in the video. His content and header are all centered and mine is not. Help?

This is what he has and what my style.css looks like by the end of the video:

/* ---- Layout Containers ---- */

.container {
  width: 70%;
  margin: 0 auto;
}

.main-header {
   background: #3acec2;
   padding: 1em 0;
}

.main-footer {
    text-align: center;
    padding: 2em 0;
    background: #d9e4ea;
}

And yet... my header isn't centered like his ends up being. I'm not understanding what exactly happened.

3 Answers

I figured it out! In the html, inside the div I forgot a letter within "container". I missed the "n" of all things! Thank you for your help!

Tracy Excell
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Tracy Excell
Front End Web Development Techdegree Graduate 15,333 Points

Hello,

You probably just forgot to remove something or add it to the html document. If you take a snap shot and post it I can take a look. For text the code:

h1 { text-align: center; }

often works well, but I can see you are trying to follow along with the video. Post your full code if you want me to look at it.

Hi there! Thank you so much for answering. Here's the html:

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Best City Guide</title>
    <link rel="stylesheet" href="css/normalize.css">
    <link rel="stylesheet" href="css/style.css">
</head>
<body>
  <header class="main-header">
    <div class="contaier">
        <h1 class="name"><a href="#">Best City Guide</a></h1>
          <ul class="main-nav">
               <li><a href="#">ice cream</a></li>
               <li><a href="#">donuts</a></li>
               <li><a href="#">tea</a></li>
               <li><a href="#">coffee</a></li>
           </ul>
     </div>
    </header>

   <div class="container">
         <h2>Welcome!</h2>
         <p>Everything in this city is worth waiting in line for.</p>
         <p>Cupcake ipsum dolor sit. Amet chocolate cake gummies jelly beans candy bonbon brownie candy. Gingerbread powder muffin. Icing cotton candy. Croissant icing pie ice cream brownie I love cheesecake cookie. Pastry chocolate pastry jelly croissant.</p>
         <p>Cake sesame snaps sweet tart candy canes tiramisu I love oat cake chocolate bar. Jelly beans pastry brownie sugar plum pastry bear claw tiramisu tootsie roll. Tootsie roll wafer I love chocolate donuts.</p>

         <h2>Great food</h2>
         <p>Croissant macaroon pie brownie. Cookie marshmallow liquorice gingerbread caramels toffee I love chocolate. Wafer lollipop dessert. Bonbon jelly beans pudding dessert sugar plum. Marzipan toffee drag&#233;e chocolate bar candy toffee pudding I love. Gummi bears pie gingerbread lollipop.</p>
     </div>

    <footer class="main-footer">
        <span>&copy;2015 Residents of The Best City Ever.</span>
    </footer>
</body>
</html>

I have been trying to follow along with the video but it's good to know that little tidbit as well! (:

Tracy Excell
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Tracy Excell
Front End Web Development Techdegree Graduate 15,333 Points

<header class="main-header"> <div class="contaier"> I think that this might be your problem? It looks like it is not meant to be here and would make your code not work correctly.

    <h1 class="name"><a href="#">Best City Guide</a></h1>
      <ul class="main-nav">
           <li><a href="#">ice cream</a></li>
           <li><a href="#">donuts</a></li>
           <li><a href="#">tea</a></li>
           <li><a href="#">coffee</a></li>
       </ul>
 </div>
</header>

I think the div is supposed to be there due to what he's done in the video but I can try removing it and see what happens. (: