title: Flexbox positioning and background
body: <p>I've just started using flexbox and I've tried to center a span element with a background both horizontally and vertically, the only problem is that when I give the span a display: flex; and height: 100%, the background spreads across the entire site and it looks like this.</p>
  <p><a href="https://i.stack.imgur.com/ZDuJW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZDuJW.png" alt="enter image description here" /></a></p>
  <p>Is it possible to get rid of the green background covering the entire site and make it cover the text only while using flexbox? Thanks in advance</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>.box {
      display: flex;
      align-items: center;
      justify-content: center;
      height: 100%;
      background: green;
  }
  
  html, body {
      height: 100%;
      margin: 0;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
       &lt;meta charset="utf-8"&gt;
       &lt;title&gt;Title&lt;/title&gt;
       &lt;link rel="stylesheet" href="normalize.css"&gt;
       &lt;link rel="stylesheet" href="styles.css"&gt;
       &lt;meta name ="viewport" content="width=device-width, initial-scale=1"&gt;
  &lt;/head&gt;
  
  &lt;span class="box"&gt;
      TEST
  &lt;/span&gt;</code></pre>
  </div>
  </div>
  </p>