title: How can I center a div within another div?
body: <p>I suppose that the <code>#container</code> will be centered within <code>#main_content</code>. However, it is not. Why isn't this working, and how can I fix it?</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>#main_content {
    top: 160px;
    left: 160px;
    width: 800px;
    min-height: 500px;
    height: auto;
    background-color: #2185C5;
    position: relative;
  }
  
  #container {
    width: auto;
    height: auto;
    margin: 0 auto;
    padding: 10px;
    position: relative;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="main_content"&gt;
    &lt;div id="container"&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>