Here is a customized solution just for you:
CSS
.wrapper {
display: block;
width: 100%;
padding: 10px 0; /* adding top and bottom paddings */
background-color: #252525;
}
.aligner {
display: block;
width: 960px; /* optimal site width */
margin: 0 auto;
}
.container {
display: inline-block;
}
HTML
<div class="wrapper">
<div class="aligner">
<div class="container">
// your content goes here
</div><!-- /container -->
</div><!-- /aligner -->
</div><!-- /wrapper -->
This method may not be the most stylish, but it allows you to add full-width background colors to any section and is compatible with browsers older than IE8. You can apply floats, positions, etc within div.container
, and it will extend the .wrapper element, expanding your background color vertically without creating white space on the right side since the background color is set on the wrapper with 100% width.
Consider each div.wrapper
as a different "section", such as 'header', 'feature', 'content', 'footer', etc...