title: css Unwanted Margin in Parent div
body: <p>I am frustrated trying to fix this issue, but couldn't tackle it.</p>
  
  <p>I have a simple html page structure:</p>
  
  <p><strong>header div, body div, and a footer div.</strong></p>
  
  <p>The problem is that the content of the body <code>div</code> (<code>.form-container</code>) affects the <code>margin</code> of the body <code>div</code> itself (<code>.body-container</code>).</p>
  
  <p><strong>Example:</strong></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>body {
    margin: 0px;
  }
  .header-container {
    height: 250px;
    width: 100%;
    background-color: red;
  }
  .body-container {
    height: 500px;
    width: 100%;
    background-color: green;
    background: #fff url('http://www.htmlcodetutorial.com/document/paper.gif') repeat scroll left top;
  }
  .footer-container {
    height: 150px;
    width: 100%;
    background-color: blue;
  }
  .form-container {
    margin-bottom: 30px;
    margin-top: 30px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="header-container"&gt;&lt;/div&gt;
  &lt;div class="body-container"&gt;
    &lt;div class="form-container"&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="footer-container"&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>How do I get rid of this <code>margin</code> in the body <code>div</code>?</p>
  
  <p><a href="https://i.stack.imgur.com/btxaM.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/btxaM.jpg" alt="enter image description here"></a></p>