title: Square table fitting in screen
body: <p>I want to create a table which is square and contains of squares. The whole table must fit inside the window without scrolling. It's a bit hard to explain, here is an image what I want:</p>
  
  <p><img src="https://i.stack.imgur.com/fuUPT.png" alt="Image"></p>
  
  <p>Is that possible? Until now, I have this but it is not really what I want...</p>
  
  <p><a href="https://jsfiddle.net/krmax44/rs136ksc/" rel="nofollow noreferrer">FIDDLE</a></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>table {
    width: 100%;
  }
  
  td {
    width: 30%;
    position: relative;
  }
  
  td:after {
    content: '';
    display: block;
    margin-top: 100%;
  }
  
  td .content {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
  }
  
  td img {
    width: 100%;
    height: 100%;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;table&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;div class="content"&gt;&lt;img src="http://placehold.it/128"&gt;&lt;/div&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;div class="content"&gt;&lt;img src="http://placehold.it/128"&gt;&lt;/div&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;div class="content"&gt;&lt;img src="http://placehold.it/128"&gt;&lt;/div&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;div class="content"&gt;&lt;img src="http://placehold.it/128"&gt;&lt;/div&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;div class="content"&gt;&lt;img src="http://placehold.it/128"&gt;&lt;/div&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;div class="content"&gt;&lt;img src="http://placehold.it/128"&gt;&lt;/div&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;div class="content"&gt;&lt;img src="http://placehold.it/128"&gt;&lt;/div&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;div class="content"&gt;&lt;img src="http://placehold.it/128"&gt;&lt;/div&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;div class="content"&gt;&lt;img src="http://placehold.it/128"&gt;&lt;/div&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;</code></pre>
  </div>
  </div>
  </p>