<div class="bg"></div>

<input type="checkbox" id="toggle" checked />
<label for="toggle">Toggle modal</label>

<div class="modal">
  <h1>CSS Modal <label for="toggle">&times;</label></h1>
  <p>Simple CSS only modal transition effect made using <em>input:checked</em> trick and filter property.</p>
  <p>I was also curious how things would behave if I set multiple labels for one checkbox.</p>
  <label for="toggle">Close</label>
</div>
@import url(https://fonts.googleapis.com/css?family=Raleway:400,100,700);
$blue: #03A9F4;
$dark-blue: #0288D1;

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Raleway";
}

body {
  background-color: #000;
  color: #eee;
  
  > label {
    box-shadow: 0 0 5px #000;
  }
}

.bg {
  position: fixed;
  top: 0; bottom: 0;
  left: 0; right: 0;
  z-index: -1;
  /* image from http://www.freeimages.com/photo/curtains-1165305
   * courtesy of Sufi Nawaz
   */
  background-image: url('http://images.freeimages.com/images/previews/6d3/curtains-1165305.jpg');
  background-size: cover;
  /* filter: grayscale(100%); */
  opacity: .3;
}

input {
  display: none;
}

label {
  background-color: $blue;
  cursor: pointer;
  padding: 0 16px;
  font-weight: 700;
  line-height: 32px;
  margin: 32px;
  display: block;
  text-align: center;
  width: 200px;
  
  &:hover, &:active, &:focus {
    background-color: $dark-blue;
  }
}

.modal {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  min-width: 300px;
  width: 50%;
  background: #eee;
  box-shadow: 0 0 22px #000;
  filter: blur(100px);
  transition: all .2s cubic-bezier(0,0,.32,1);
  visibility: hidden;
  opacity: 0;
  color: #333;
  padding-bottom: 16px;
  
  h1 {
    font-weight: 100;
    background-color: $blue;
    padding: 16px;
    color: #fff;
    margin: 0;
    
    label {
      float: right;
      position: absolute;
      margin: 0;
      width: 68px;
      line-height: 68px;
      font-size: 48px;
      font-weight: 100;
      top: 0;
      right: 0;
    }
  }
  
  p {
    padding: 24px;
  }
  
  p + p {
    padding-top: 0;
  }
  
  label {
    margin: 0 auto;
    color: #fff;
  }
}

input:checked ~ .modal {
  filter: none;
  visibility: visible;
  opacity: 1;
}
View Compiled
/* no need */

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.