title: layout dilemma: Header, Content and Footer which expands their background color horizontally (but at the same time have centered content)?
body: <p>I created a layout were everything is centered (with the "margin="0 auto" technique). I also wanted the header and footer to be black and expand to both sides when the browser enlarge to the sides. If I center everything the black background will center too and it wont expand indefinably. The only solution I found was to apply the background style to the header and footer and using a class inside them (.container) to center the content (I think Stack Overflow uses this technique with the footer). It's nice but I would like to know if there's a better way rather than adding additional divs? </p>
  
  <p>MY HTML:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
      &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
          &lt;title&gt;globo design&lt;/title&gt; 
          &lt;link href="styles/layout.css" rel="stylesheet" type="text/css" /&gt;
          &lt;link href="styles/slideshow.css" rel="stylesheet" type="text/css" /&gt;
          &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"&gt;&lt;/script&gt;
          &lt;script type="text/javascript" src="scripts/slideshow.js"&gt;&lt;/script&gt; 
      &lt;/head&gt; 
      &lt;body id="home"&gt;
      &lt;!-- header --&gt;
      &lt;div id="header"&gt;
          &lt;div class="container"&gt;
              &lt;h1&gt;&lt;a href="http://widerdesign.co.nr/"&gt;wider design&lt;/a&gt;&lt;/h1&gt;
              &lt;!-- navigation --&gt;
              &lt;ul id="navigation"&gt; 
                  &lt;li class="home"&gt;&lt;a href="index.php"&gt;&lt;span&gt;home&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                  &lt;li class="portfolio"&gt;&lt;a href="portfolio.php"&gt;&lt;span&gt;portfolio&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                  &lt;li class="about"&gt;&lt;a href="about.php"&gt;&lt;span&gt;about&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
                  &lt;li class="contact"&gt;&lt;a href="contact.php"&gt;&lt;span&gt;contact&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;!-- content --&gt;
      &lt;div id="content"&gt;
          &lt;div id="top-column"&gt;
              &lt;p&gt;We &lt;strong&gt;design and develop&lt;/strong&gt; clean and effective webs in the &lt;strong&gt;top 3 languages&lt;/strong&gt; 
              on the Internet. Internet is mean to reach the whole world.You are mean to reach the whole audience:&lt;/p&gt; 
          &lt;/div&gt;
          &lt;div id="middle-column"&gt;
              &lt;h2&gt;Our Work&lt;/h2&gt;
              &lt;!-- slideshow --&gt;
              &lt;div id="slideshow"&gt;
                  &lt;div id="slidesContainer"&gt;
                      &lt;div class="slide"&gt;
                          Content for slide 1 goes here
                      &lt;/div&gt;
                      &lt;div class="slide"&gt;
                          Content for slide 2 goes here
                      &lt;/div&gt;
                      &lt;div class="slide"&gt;
                          Content for slide 3 goes here
                      &lt;/div&gt;
                      &lt;div class="slide"&gt;
                          Content for slide 4 goes here
                      &lt;/div&gt;  
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
              &lt;div id="left-column"&gt;
                  &lt;h2&gt;Web Design&lt;/h2&gt;
                  &lt;p&gt;Create a web site easily with this online HTML generator. Follow the steps below to create web pages then click "view html page" to test it once it's completed. You can copy and paste generated code where you wish within the generated document(s). For example: You created an HTML table with 3 rows and 3 columns. You then added a link, which appears below the HTML table. If you want the link inside the HTML table, just cut and paste it inside the table in place of an "ADD TEXT" statement. Any where text,images,or links need to be, there will be a generated "ADD TEXT" statement in the HTML pages.&lt;/p&gt;
              &lt;/div&gt;
              &lt;div id="right-column"&gt;
                  &lt;h2&gt;Web Translation&lt;/h2&gt;
                  &lt;p&gt;Create a web site easily with this online HTML generator. Follow the steps below to create web pages then click "view html page" to test it once it's completed. You can copy and paste generated code where you wish within the generated document(s). For example: You created an HTML table with 3 rows and 3 columns. You then added a link, which appears below the HTML table. If you want the link inside the HTML table, just cut and paste it inside the table in place of an "ADD TEXT" statement. Any where text,images,or links need to be, there will be a generated "ADD TEXT" statement in the HTML pages.&lt;/p&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;!-- footer --&gt;
      &lt;div id="footer"&gt;
          &lt;div class="container"&gt;
  
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;script type="text/javascript"&gt;
          var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
          document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
          &lt;/script&gt;
          &lt;script type="text/javascript"&gt;
          try {
          var pageTracker = _gat._getTracker("UA-11932489-1");
          pageTracker._trackPageview();
          } catch(err) {}&lt;/script&gt;
      &lt;/body&gt; 
      &lt;/html&gt; 
  </code></pre>
  
  <p>MY CSS:</p>
  
  <pre><code>/* reset */
  * { 
      margin: 0;
      padding: 0;
  }
  /* tags */
  body {
      background-color: #FFFFFF;
      color: #5D5D5D;
      font-family: Arial, "MS Trebuchet", sans-serif;
      font-size: 75%;
  }
  h1 {
      background: #2D2D2D url(../images/logo.png) no-repeat scroll 0 0;
      margin-bottom: 20px;
      text-indent: -9999px;
  }
  h2 {
      color: #418EE4;
      font-family: Arial;
      font-size: 16px;
      font-weight: normal;
      margin-bottom: 10px;
  }
  a {
      font-family: Arial, "MS Trebuchet", sans-serif;
  }
  /* classes */
  .container {
      margin: 0 auto;
      width: 960px;
  }
  /* header */
  #header {
      background-color: #2D2D2D;
      padding-top: 10px;
  }
  /* navigation */
  ul#navigation {
      height: 20px;
      list-style: none;
      margin: 0;
      padding: 0;
  }
  ul#navigation li {
      float: left;
  }
  ul#navigation li a {
      background: url(../images/tab.png);
      color: #C0C0C0;
      display: block;
      height: 20px;
      outline: none;
      padding-left: 10px;
      text-decoration: none;
  }
  ul#navigation li a:hover {
      color:  #418EE4;
  }
  #home li.home a, #portfolio li.portfolio a, #about li.about a, #contact li.contact a {
      background-position: 0 -32px;
      color: #757575;
  }
  ul#navigation span {
      background: url(../images/tab.png) 100% 0;
      display: block;
      line-height: 20px;
      padding-right: 20px;
  }
  #home li.home span, #portfolio li.portfolio span, #about li.about span, #contact li.contact span {
      background-position: 100% -32px;
  }
  /* content */
  #content {
      background-color: #FFFFFF;
      padding: 20px;
      overflow: hidden;
      margin: 0 auto;
      width: 960px;
  }
  #content h2 {
      border-top: 2px dashed #F0F0F0;
      border-bottom: 2px dashed #F0F0F0;
      padding: 5px 0 5px 0;
      margin: 15px 0 15px 0;
  }
  #top-column {
      color: #818181;
      font-size: 16px;
      font-family: Arial, "MS Trebuchet", sans-serif;
      margin: 10px 0 10px 0;
      padding: 10px 0 20px 0;
  }
  #top-column strong {
      font-weight: normal; 
      color: #3C3C3C;
  }
  #middle-column {
      float: left;
  }
  #right-column {
      float: left;
      width: 420px;
  }
  #left-column {
      float: right;
      width: 500px;
  }
  /* footer */
  #footer {
      clear: both;
      background-color: #2D2D2D;
      height: 200px;
  }
  </code></pre>