title: CSS - Weird White-Space In Border of Image
body: <p>I have two images that I gave borders to (1px solid black), but in my browser they are rendered with a weird white-space - kind of like an involuntary padding.</p>
  
  <p>The white space is on one side only, but depending on the zoom it can change the side of the border (e.g. suddenly the "pseudo-padding" is no longer on the right, but on the top), or even on two sides at the same time.</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>.img img {
    width: 100%;
    vertical-align: middle;
    display: block;
    border: 1px solid black;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;section class="imgrid"&gt;
    &lt;div class="img"&gt;
      &lt;img src="http://via.placeholder.com/500x500" /&gt;
    &lt;/div&gt;
    &lt;div class="img"&gt;
      &lt;img src="http://via.placeholder.com/500x500" /&gt;
    &lt;/div&gt;
  &lt;/section&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>That's about it in terms of relevant code. The images are 500px squares (so 500x500).</p>
  
  <p>Edit: This has nothing to do with the suggested 'similar question' <a href="https://stackoverflow.com/questions/5804256">here</a>. I have already tried vertical align before I created this question. I have added width: 100% and vertical-align: middle to the snippet to illustrate this.</p>
  
  <p>The problem looks like so:</p>
  
  <p><a href="https://i.imgur.com/0hH5R3B.png" rel="noreferrer">on the right</a> <a href="https://i.stack.imgur.com/TFT26.png" rel="noreferrer"><img src="https://i.stack.imgur.com/TFT26.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.imgur.com/eYt8aUK.png" rel="noreferrer">at the bottom</a> <a href="https://i.stack.imgur.com/FTOB1.png" rel="noreferrer"><img src="https://i.stack.imgur.com/FTOB1.png" alt="enter image description here"></a></p>