title: Flexbox - center text vertically
body: <p>I have a square-shaped flexbox, that is completely covered with one hyperlink. </p>
  
  <p>Now I want to vertically center the content of the flexbox.</p>
  
  <p>However, using a <code>div</code> element with the property <code>display: table</code> and a nested <code>div</code> with the property <code>display: table-cell; vertical-align: middle</code> does not work, since I lose the square shape.</p>
  
  <p>If I use <code>div</code>s instead of <code>ul</code> and <code>li</code> I lose the property of being able to click everywhere.</p>
  
  <p>I would like "Text" to be aligned in the horizontal and vertical center of the red box:</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 {
    margin: 0px;
    width: 100%;
  }
  main {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
  }
  .flex-container {
    width: 100%;
  }
  ul {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    -webkit-padding-start: 0px;
    -webkit-margin-before: 0px;
    -webkit-margin-after: 0px;
  }
  li {
    display: flex;
    flex-direction: column;
    width: 50%;
  }
  .red {
    background-color: red;
  }
  .white {
    background-color: white;
  }
  .tile:before {
    content: '';
    float: left;
    padding-top: 100%;
  }
  .tile {
    text-align: center;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;main&gt;
    &lt;div class="flex-container"&gt;
      &lt;ul&gt;
        &lt;li class="red"&gt;
          &lt;a href="/"&gt;
            &lt;div class="tile"&gt;
              Text
            &lt;/div&gt;
          &lt;/a&gt;
        &lt;/li&gt;
      &lt;/ul&gt;
    &lt;/div&gt;
  &lt;/main&gt;</code></pre>
  </div>
  </div>
  </p>