title: Center div elements like text
body: <p>I looked around but couldn't find something that works. I'd like to somehow center <code>div</code> elements that have <code>class="box"</code>. Here is an example of how I would like it to be:</p>
  
  <p><a href="https://i.stack.imgur.com/pLiMj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pLiMj.png" alt="enter image description here"></a></p>
  
  <p>Can someone tell me how I would go about doing this? I have tried something that obviously wouldn't work but here is what I have so far:</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>body {
    background-color: rgb(32, 32, 36);
    height: 100%;
  }
  #main {
    background-color: rgb(50, 50, 56);
    width: 75%;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: auto;
    margin-top: auto;
    box-shadow: 10px 10px 20px rgb(0, 0, 0);
    border-style: solid;
    border-width: 3px;
    border-color: rgb(20, 20, 26);
    overflow: auto;
    height: 95vh;
    color: rgb(0, 0, 0);
  }
  .box {
    margin: auto 0;
    left: 25;
    right: 25;
    top: 25;
    bottom: 25;
    height: 160px;
    width: 140px;
    border-style: solid;
    border-width: 3px;
    border-color: rgb(20, 20, 26);
    box-shadow: 10px 10px 20px rgb(0, 0, 0);
    background-color: rgb(70, 70, 76);
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;body&gt;
    &lt;div id="main"&gt;
      &lt;div class="box"&gt;&lt;/div&gt;
      &lt;div class="box"&gt;&lt;/div&gt;
      &lt;div class="box"&gt;&lt;/div&gt;
      &lt;div class="box"&gt;&lt;/div&gt;
    &lt;/div&gt;
  &lt;/body&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>P.S. Don't just post code, please. I want to learn so please explain how it all works</p>