CSS CSS Layout Basics Getting Started with CSS Layout Centering Page Content and Creating a Full-width Header

Footer and header not extending across the page.

My header and footer are currently staying the same in my window. I'm following every step but I keep getting the same result. Here's the code in question from the html and css files...

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="container">
    <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>

<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>


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

</body> </html>

CSS: /* ---- Navigation ---- */

.name { margin: 0; }

/* ---- 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; }

/* ---- Page Elements ---- */

1 Answer

Steven Parker
Steven Parker
203,990 Points

When you say, "Footer and header not extending across the page", are you talking about the tiny bit of white space at the edges of the screen? That's the default body margin and it can be removed with this CSS:

body { margin: 0; }

And it's normal for the header and footer to be in the same in window, with the other page content in between them.

Thanks that's exactly what I meant. It seems to be working now.