title: Why adding 1px padding adding 10px in height of div
body: <p>I am trying to learn CSS basics. Below is the HTML and CSS for which I am unable to understand something</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-sizing: border-box;
  }
  
  body {
    font-family: 'Montserrat', sans-serif;
    margin: 0;
  }
  
  .section-title {
    color: #2ddf5c;
  }
  
  main {
    background-color: burlywood;
  }
  
  #product-overview {
    background: #ff1b68;
    width: 100%;
    height: 528px;
    padding: 10px;
  }
  
  .main-header {
    background: #2ddf5c;
    padding: 0px 16px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;header class="main-header"&gt;
    &lt;div&gt;
      &lt;a href="index.html"&gt;
                      uhost
                  &lt;/a&gt;
    &lt;/div&gt;
    &lt;nav class="main-nav"&gt;
      &lt;ul class="main-nav__items"&gt;
        &lt;li class="main-nav__item"&gt;&lt;a href="#"&gt;Packages&lt;/a&gt;&lt;/li&gt;
        &lt;li class="main-nav__item"&gt;&lt;a href="#"&gt;Customers&lt;/a&gt;&lt;/li&gt;
        &lt;li class="main-nav__item"&gt;&lt;a href="#"&gt;Start hosting&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
    &lt;/nav&gt;
  &lt;/header&gt;
  &lt;main&gt;
    &lt;section id="product-overview"&gt;
      &lt;h1&gt;Get the freedom you deserve&lt;/h1&gt;
    &lt;/section&gt;
    &lt;section id="plans"&gt;
      &lt;h1&gt;Choose your plan&lt;/h1&gt;
    &lt;/section&gt;
  &lt;/main&gt;</code></pre>
  </div>
  </div>
  </p>
  <p><a href="https://i.stack.imgur.com/5jXse.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5jXse.png" alt="enter image description here" /></a></p>
  <p>We can see that there is a small gap between red and green area.
  As per my understanding, this gap exists because both nav and main are block elements.</p>
  <p>Right now, height of header element is 90px(approx.)
  But if I am trying to update padding of main-header, then browser is removing blank area between header and main elements, and also updating the height of header to 106px</p>
  <pre><code>.main-header {
          background: #2ddf5c;
          padding: 1px 16px;
   }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/9urlO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9urlO.png" alt="enter image description here" /></a></p>
  <p>Please help me understand why this is happening.</p>