Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              .wrapper
  .container
    article 
      h2 Aenean posuere
      p Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras pharetra quis enim a fermentum. Etiam sed interdum tellus, ac gravida ante. Etiam eu mi at erat molestie mattis eu a elit. Cras ac varius mi. Maecenas tempus non urna vitae posuere. Aenean posuere, mi non ullamcorper sollicitudin, sapien elit molestie risus, a maximus felis lectus vel sapien. Vestibulum convallis dolor in magna malesuada ultrices. Sed et ipsum est. Sed laoreet tellus sit amet auctor tempus. Proin et cursus nulla, a vulputate ante. Donec pellentesque rhoncus elementum. Nullam vitae diam elementum, tincidunt elit non, mattis nibh.
      button.toggleModal modal
      
    article 
      h2 Vestibulum convallis
      p Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras pharetra quis enim a fermentum. Etiam sed interdum tellus, ac gravida ante. Etiam eu mi at erat molestie mattis eu a elit. Cras ac varius mi. Maecenas tempus non urna vitae posuere. Aenean posuere, mi non ullamcorper sollicitudin, sapien elit molestie risus, a maximus felis lectus vel sapien. Vestibulum convallis dolor in magna malesuada ultrices. Sed et ipsum est. Sed laoreet tellus sit amet auctor tempus. Proin et cursus nulla, a vulputate ante. Donec pellentesque rhoncus elementum. Nullam vitae diam elementum, tincidunt elit non, mattis nibh.
      button.toggleModal modal
 
.modal.is-active
   .modal__header
     .inner
       h2 Donec pellentesque
   .modal__content
      .inner
        p Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras pharetra quis enim a fermentum. Etiam sed interdum tellus, ac gravida ante.
   .modal__footer
     .inner
        button.toggleModal close
 
svg(version="1.1", xmlns="http://www.w3.org/2000/svg")
   filter#blur
      feGaussianBlur(stdDeviation="3")

            
          
!
            
              
@import url(https://fonts.googleapis.com/css?family=Open+Sans);

/* 
Variables
*/
$color-white: #fff;
$color-dark: #444;
$color-gray: #333;
$color-bg: #eee;
$color-active: #1abc9c;
$gutter: 20px;
$small: "only screen and (min-width: 650px)";
$svgBlur: url("#blur");

/*
Animations
*/
@keyframes slide {
  from {
    top: 0;
  }
  to {
    top: 50%;
  }
}

/*
Reset
*/
*:focus {
    outline: 0; /* removes blue border on focus */
}
button {
	background: none;
 	background-clip: padding-box; /* prevents bg color from leaking outside the border */
	display: inline-block;
	border: 0;
	user-select: none;
	-webkit-touch-callout: none;
	-webkit-appearance: button; /* for input */
    -webkit-user-select: none; /* for button */
       -moz-user-select: none;
        -ms-user-select: none;
}

/* apply a natural box layout model to all elements, but allowing components to change */
html {
  box-sizing: border-box;
  position: relative;
  min-height: 100%;
  font-family: 'Open Sans', sans-serif;
}

body {
  heigth: 100%;
  background: #eee;
  overflow: none;
  
  &.is-blurred {
    overflow: hidden;
  
    .wrapper {
      filter: $svgBlur; /* SVG filters for browser support. */ 
      filter: blur(3px); /* works in chrome */
      -webkit-transition : -webkit-filter 500ms linear;
      pointer-events: none;
      user-select: none;
    }
  }
}

*, 
*:before, 
*:after {
  box-sizing: inherit;
}

/*
Typography
*/
h2 {
  color: #444;
  font-size: 30px;
  line-height: 32px;
}
p {
  color: #555;
  font-size: 16px;
  line-height: 24px;
}


.container {
    position: relative;
    margin:0 auto;
    max-width: 960px;
    box-sizing: border-box;
    padding-top: 40px;
}

article {
  background: #fff;
  padding: 20px;
  margin-bottom: 40px;
  border-radius: 5px;
  
  p,
  h2 {  
    padding-bottom: $gutter;
  }
  h2 {
    padding-top: 10px;
  }
}

button {
  border: 2px solid $color-active;
  color: $color-active;
  border-radius: 4px;
  font-size: 20px;
  padding: 10px 40px;
  cursor: pointer;
  
  &:hover {
    border-color: darken($color-active, 10%);
    color: darken($color-active, 10%);
  }
}
.modal {
  display: none;
	position: fixed;
	top: 50%;
	width: 100%;
	height: auto;
	margin-top: -150px;
  background-color: $color-white;
	border-radius: 3px;
	z-index: 999;
  box-shadow: 0px 1px 3px 0px darken($color-bg, 10%);

	@media #{$small} {
		left: 50%;
		margin-left: -260px;
		max-width: 520px;
	}
  
  &.is-active {
    display: block;
    animation: 1s linear slide; // a small animation for the modal
  }
  .inner {
    position: relative;
    padding: 20px;
  }
}
.modal__header {
	border-bottom: 1px solid darken($color-bg, 5%);
}
.modal__footer {
  text-align: center;
  
  button {
    display: inline-block;
  }
}
            
          
!
            
              $('body').addClass('is-blurred');

$('.toggleModal').on('click', function (event) {
  event.preventDefault();
  
  $('.modal').toggleClass('is-active');
  $('body').toggleClass('is-blurred');
});

// some improvements on the modal suggested by @iammarkoradak
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console