title: Why can't I center with margin: 0 auto?
body: <p>I have a <code>#header</code> div that is <code>100% width</code> and within that div I have an unordered list. I have applied <code>margin: 0 auto</code> to the unordered list but it won't center it within the header div. </p>
  
  <p>Can anybody please tell me why? I thought that if I define the width of the parent div, then the unordered list should be able to center itself with <code>margin: 0 auto</code>. What am I missing?</p>
  
  <p>Here is my code: </p>
  
  <pre><code>&lt;style&gt;
  
  * {
      margin: 0;
      padding: 0;
  }
  
  #header {
      width: 100%;    
      background-color: #333;
      min-height: 160px;
      font-family:Arial, Helvetica, sans-serif;
  }
  
  #sitename {
      font-size: 50px;
      width: 620px;
      margin:0 auto;
      padding-top: 35px;
      color:#999;
  }
  
  #header ul {
      float: right;
      margin: 0 auto;
  }
  
  #header ul li {
      float: left;
      padding-right: 20px;
      list-style-type: none;
      font-size: 20px;
  }
  
  &lt;/style&gt;
  
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;div id="header"&gt;
      &lt;h1 id="sitename"&gt;Photography Auction Site&lt;/h1&gt;
  
      &lt;ul&gt;
          &lt;li&gt;List of Photos&lt;/li&gt;
          &lt;li&gt;Image Gallery&lt;/li&gt;
          &lt;li&gt;Contact Us&lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>