title: Prevent modal content open by default
body: <p>How to make the content inside not open before it was clicked? Whenever I make modal or dropdown list menu, it always, by default, opens the content before it was clicked. Why?</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-js lang-js prettyprint-override"><code>var modal = document.getElementById('modal-wrap');
  var open = document.getElementById('modal-open');
  var close = document.getElementById('modal-close');
  
  
  open.onclick = function() {
      modal.style.display = "block";
  };
  
  
  close.onclick = function() {
      modal.style.display = "none";
  };
  
  window.onclick = function(event) {
      if (event.target == modal) {
          modal.style.display = "none";
      }
  }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.modal-wrap {
      display: none;
      position: fixed;
      z-index: 99;
      padding-top: 100px;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      overflow: auto;
      opacity: 40%;
      background-color: rgb(0,0,0);
      background-color: rgba(0,0,0,0.4); 
  }
  
  .modal-content {
      background-color: #fefefe;
      margin: auto;
      padding: 20px;
      border: 1px solid #888;
      width: 80%;
  }
  
  .modal-close {
      float: right;
      padding: 5px;
      border-radius: 5px;
      font-weight: bold;
  }
  
  .modal-close:hover,
  .modal-close:focus {
      color: #000;
      text-decoration: none;
      cursor: pointer;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;button id="modal-open"&gt;Open&lt;/button&gt;
        &lt;div id="modal-wrap" class="modal-wrap"&gt;
          &lt;div class="modal-content"&gt;
            &lt;button class="modal-close" id="modal-close"&gt;Close&lt;/button&gt;
            &lt;p&gt;Edit the data &lt;/p&gt;
                &lt;div class="form-group"&gt;
                &lt;label for="name"&gt;Name&lt;/label&gt;
                &lt;input id="name" placeholder="Input your Name"&gt; 
                &lt;/div&gt;
    
          &lt;/div&gt; 
  
        &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>and also it runs well (as expected) in the snippet or in the JS Bin. But why does its appearance become different by default when am I running it on my (project) localhost? <a href="https://i.stack.imgur.com/EP6bh.jpg" rel="nofollow noreferrer">here</a></p>