2

I have researching on web page dimensions and i have since settled on grid 960px. However i don't understand one thing on headers and footers.Take for instance stackoverflow's header that houses the username | logout | chat | meta | about | faq and the search box.It runs end to end of the browser.How can i make my header run end to end in css?.

Thanks.

Gandalf
  • 1
  • 29
  • 94
  • 165

3 Answers3

2

In your css:

#header {
height: 100px;
width: 100%;
background-color: red;
}
#middle {
width: 960px;
margin: auto;
background-color: blue;
}
#footer {
width: 100%;
height: 100px;
background-color: green;
}

This is just the relevant bits, not the entire CSS code :)

benhowdle89
  • 36,900
  • 69
  • 202
  • 331
  • 1
    Hi ben,i followed your example and googled width: 100px and i was lucky to nail what i was exactly after.http://www.cssgirl.com/resources/2008/06/07/create-full-width-header-footer-with-centered-content-using-css/ – Gandalf Jan 17 '11 at 10:55
  • You did mean width: 100%, not width: 100px didnt you? – benhowdle89 Jan 17 '11 at 10:56
0

960.gs is just a "blueprint" to work from. Probably better to learn the basics before you dive in to a grid based system.

SO just uses a negative margin:

#custom-header {
    background-color: #EEE;
    height: 31px;
    margin-bottom: -31px;
}

before a <div id="header"></div>, which is a 960px wide centered div.

Ross
  • 18,117
  • 7
  • 44
  • 64
0

Try This

@media print {
    @page {
        margin-top:0;
        margin-bottom:0;
        margin-top:initial;
    }
}
HD..
  • 1,456
  • 3
  • 28
  • 48