Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="container">
  <h1 class="center">Simple Modal with Blur BG Effect</h1>
  <p class="center">by <a href="http://haneenkrimly.com" target="_blank">Haneen Krimly</a></p>
  
  <section class="content container-button">
    <a href="#modal" class="button">Click for Modal</a>
  </section>
  
  <section class="content">
    <h3>Section Heading</h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. At auctor urna nunc id cursus metus. Ac odio tempor orci dapibus ultrices in. Ullamcorper a lacus vestibulum sed arcu. Sed blandit libero volutpat sed cras ornare arcu dui. Viverra mauris in aliquam sem fringilla. Augue eget arcu dictum varius duis at. Sed velit dignissim sodales ut. Dignissim diam quis enim lobortis scelerisque fermentum. Id aliquet lectus proin nibh nisl condimentum. Arcu dictum varius duis at consectetur lorem donec massa. Fringilla phasellus faucibus scelerisque eleifend. Adipiscing enim eu turpis egestas. Aliquam faucibus purus in massa tempor nec feugiat. Condimentum mattis pellentesque id nibh tortor.</p>
  </section>
  
  <section class="content">
    <h3>Section Heading</h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. At auctor urna nunc id cursus metus. Ac odio tempor orci dapibus ultrices in. Ullamcorper a lacus vestibulum sed arcu. Sed blandit libero volutpat sed cras ornare arcu dui. Viverra mauris in aliquam sem fringilla. Augue eget arcu dictum varius duis at. Sed velit dignissim sodales ut. Dignissim diam quis enim lobortis scelerisque fermentum. Id aliquet lectus proin nibh nisl condimentum. Arcu dictum varius duis at consectetur lorem donec massa. Fringilla phasellus faucibus scelerisque eleifend. Adipiscing enim eu turpis egestas. Aliquam faucibus purus in massa tempor nec feugiat. Condimentum mattis pellentesque id nibh tortor.</p>
  </section>
  
  <section class="content">
    <h3>Section Heading</h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. At auctor urna nunc id cursus metus. Ac odio tempor orci dapibus ultrices in. Ullamcorper a lacus vestibulum sed arcu. Sed blandit libero volutpat sed cras ornare arcu dui. Viverra mauris in aliquam sem fringilla. Augue eget arcu dictum varius duis at. Sed velit dignissim sodales ut. Dignissim diam quis enim lobortis scelerisque fermentum. Id aliquet lectus proin nibh nisl condimentum. Arcu dictum varius duis at consectetur lorem donec massa. Fringilla phasellus faucibus scelerisque eleifend. Adipiscing enim eu turpis egestas. Aliquam faucibus purus in massa tempor nec feugiat. Condimentum mattis pellentesque id nibh tortor.</p>
  </section>
  
  <section class="content">
    <h3>Section Heading</h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. At auctor urna nunc id cursus metus. Ac odio tempor orci dapibus ultrices in. Ullamcorper a lacus vestibulum sed arcu. Sed blandit libero volutpat sed cras ornare arcu dui. Viverra mauris in aliquam sem fringilla. Augue eget arcu dictum varius duis at. Sed velit dignissim sodales ut. Dignissim diam quis enim lobortis scelerisque fermentum. Id aliquet lectus proin nibh nisl condimentum. Arcu dictum varius duis at consectetur lorem donec massa. Fringilla phasellus faucibus scelerisque eleifend. Adipiscing enim eu turpis egestas. Aliquam faucibus purus in massa tempor nec feugiat. Condimentum mattis pellentesque id nibh tortor.</p>
  </section>
</div>

<div id="modal" class="modal">
  <div class="modal-content">
    <a href="#" title="Close" class="modal-close">Close</a>
    <h3>Modal Heading</h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. At auctor urna nunc id cursus metus. Ac odio tempor orci dapibus ultrices in. Ullamcorper a lacus vestibulum sed arcu. Sed blandit libero volutpat sed cras ornare arcu dui. Viverra mauris in aliquam sem fringilla. Augue eget arcu dictum varius duis at. Sed velit dignissim sodales ut. Dignissim diam quis enim lobortis scelerisque fermentum. Id aliquet lectus proin nibh nisl condimentum. Arcu dictum varius duis at consectetur lorem donec massa. Fringilla phasellus faucibus scelerisque eleifend. Adipiscing enim eu turpis egestas. Aliquam faucibus purus in massa tempor nec feugiat. Condimentum mattis pellentesque id nibh tortor.</p>
    </div>
</div>
              
            
!

CSS

              
                * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  background: linear-gradient(135deg, #53982c, #39c2de);
  color: white;
  font-family: "Lato", sans-serif;
  font-weight: 300;
  font-size: 20px;
  line-height: 1.5;
  @media screen and (max-width: 820px) {
    font-size: 16px;
  }
}

.container {
  width: 80%;
  min-height: 100vh;
  margin: 0 auto;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  @media screen and (max-width: 820px) {
    flex-direction: column;
  }
}

.center {
  text-align: center;
}

h1 {
  font-weight: 300;
  font-size: 2em;
  text-align: center;
  line-height: 1.3;
  padding: 40px 20px 0 20px;
}

h3 {
  margin-bottom: 20px;
}

p {
  a {
    color: white;
    text-decoration: none;
    border-bottom: 1px solid white;
    transition: border .3s;
  }
  a:hover {
    border-bottom: 1px solid rgba(255,255,255,0);
  }
}

.content {
  padding: 30px 0;
}

.container-button {
  padding-top: 80px;
}

.button {
  text-decoration: none;
  color: white;
  background: #363636;
  padding: 10px 20px;
  margin-top: 20px;
  border-radius: 10000px;
  transition: .3s all ease-in-out;
  box-shadow: 0 2px 5px 0 rgba(3,6,26,0.15);
  &:hover {
    transform: scale(1.05);
    background: white;
    color: #363636;
  }
}

.blur {
  filter: blur(5px);
}

.modal {
  position: fixed;
  background: rgba(0, 0, 0, 0.5);
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 5% 10%;
  z-index: 999;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s;
  &:target {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
  }
  .modal-content {
    max-height: 95%;
    padding: 40px;
    background: white;
    border-radius: 5px;
    overflow: auto;
    position: relative;
  }
  h3, p {
    color: #363636;
  }
}

.modal-close {
  color: #aaa;
  line-height: 50px;
  font-size: 80%;
  position: absolute;
  right: 0;
  text-align: center;
  top: 0;
  width: 70px;
  text-decoration: none;
  &:hover {
    color: #363636;
  }
}

              
            
!

JS

              
                $(".button").click(function() {
  $(".container").addClass("blur");
});

$(".modal-close").click(function() {
  $(".container").removeClass("blur");
});
              
            
!
999px

Console