title: how to make div center horizontally with fixed position?
body: <p>I want div to be center horizontally, css code is this:</p>
  
  <pre><code>&lt;style type="text/css"&gt;
  #footer{
      position: fixed;
      bottom: 20px;
      background-color: red;
      width:500px;
              margin: auto;/*left:auto; right:auto;*/
  }
  &lt;/style&gt;
  </code></pre>
  
  <p>and html code:</p>
  
  <pre><code>&lt;body&gt;
  &lt;div id="footer"&gt;hello world&lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>I think there is no need to explain my css code, it is almost self-explanatory, but the div is not center horizontally, is there any way to make this?
  Thanks in advance.</p>