title: Alternative to using label and input in css modal
body: <ol>
  <li><p>I got this css modal script and wondering why I can't replace <code>&lt;label&gt;</code> with <code>&lt;a&gt;</code> or <code>&lt;div&gt;</code> tag. </p></li>
  <li><p>Also, What is the point of this line below? Why can't I replace <code>&lt;input&gt;</code> with something else like <code>&lt;div&gt;</code>?</p>
  
  <p></p></li>
  </ol>
  
  <p>Here's the complete CSS Code:</p>
  
  <pre><code>.modal {
    opacity: 0;
    visibility: hidden;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    text-align: left;
    background: rgba(0,0,0, .9);
    transition: opacity .25s ease;
  }
  
  .modal__bg {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    cursor: pointer;
  }
  
  .modal-state {
    display: none;
  }
  
  .modal-state:checked + .modal {
    opacity: 1;
    visibility: visible;
  }
  
  .modal-state:checked + .modal .modal__inner {
    top: 0;
  }
  
  .modal__inner {
    transition: top .25s ease;
    position: absolute;
    top: -20%;
    right: 0;
    bottom: 0;
    left: 0;
    width: 50%;
    margin: auto;
    overflow: auto;
    background: #fff;
    border-radius: 5px;
    padding: 1em 2em;
    height: 50%;
  }
  
  .modal__close {
    position: absolute;
    right: 1em;
    top: 1em;
    width: 1.1em;
    height: 1.1em;
    cursor: pointer;
  }
  
  .modal__close:after,
  .modal__close:before {
    content: '';
    position: absolute;
    width: 2px;
    height: 1.5em;
    background: #ccc;
    display: block;
    transform: rotate(45deg);
    left: 50%;
    margin: -3px 0 0 -1px;
    top: 0;
  }
  
  .modal__close:hover:after,
  .modal__close:hover:before {
    background: #aaa;
  }
  
  .modal__close:before {
    transform: rotate(-45deg);
  }
  
  @media screen and (max-width: 768px) {
  
    .modal__inner {
      width: 90%;
      height: 90%;
      box-sizing: border-box;
    }
  }
  </code></pre>
  
  <p>and HTML</p>
  
  <pre><code>&lt;p&gt;
      &lt;label class="btn" for="modal-1"&gt;Show me modal with a cat&lt;/label&gt;
  &lt;/p&gt;
  
  &lt;input class="modal-state" id="modal-1" type="checkbox" /&gt;
  &lt;div class="modal"&gt;
    &lt;label class="modal__bg" for="modal-1"&gt;&lt;/label&gt;
    &lt;div class="modal__inner"&gt;
      &lt;label class="modal__close" for="modal-1"&gt;&lt;/label&gt;
      &lt;h2&gt;The title!&lt;/h2&gt;
      &lt;p&gt;This is the body&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong><a href="https://jsfiddle.net/skvdp0q9/" rel="nofollow noreferrer">JSFIDDLE DEMO</a></strong></p>