title: How to center body on a page?
body: <p>I'm trying to center the body element on my HTML page.</p>
  
  <p><img src="https://i.stack.imgur.com/zkwBF.png" alt="enter image description here"></p>
  
  <p>Basically, in the CSS I set the body element to be <code>display: inline-block;</code> so that it is only as wide as its contents. That works fine. However, <code>margin: 0px auto;</code> doesn't center it on the page.</p>
  
  <p>Does anyone know how to fix this? I want the big blue square to be centered on the page, not floating to the left like it is now.</p>
  
  <p>Here's my CSS:</p>
  
  <pre><code>body {
      display: inline-block;
      margin: 0px auto;
      text-align: center;
  }
  </code></pre>