100% Width Headers
CSS August 8th, 2007
A design may call for the header or footer to span 100% width of a page, but the body of a design spread to a set width. Easily implement this by extracting the 100% width item from your main container div.
HTML:
CSS:
-
body{
-
margin: 0;
-
padding: 0;
-
}
-
#header, #footer{
-
background-color: #ccc;
-
color: #000;
-
padding: 1em 0 1em 0;
-
text-align: center;
-
width: 100%;
-
}
-
#container{
-
margin: 0 auto; /* this centers the div on the window */
-
width: 60%;
-
}
Easy as sliced cake!
Popularity: 9% [?]









July 22nd, 2010 at 11:23 am
Honestly amazing post!