cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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 {
  height: 100%;
  background-color: rgba(27, 43, 58, 1);
  background-image: url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%0A%20%20%20%20%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%0A%20%20%20%20%20width%3D%225120%22%20height%3D%222893%22%0A%20%20%20%20%20viewBox%3D%220%200%205120%202893%22%3E%0A%20%20%3Cfilter%20id%3D%22blur%22%20filterUnits%3D%22userSpaceOnUse%22%20color-interpolation-filters%3D%22sRGB%22%3E%0A%20%20%20%20%3CfeGaussianBlur%20stdDeviation%3D%2220%2020%22%20edgeMode%3D%22duplicate%22%20/%3E%0A%20%20%20%20%3CfeComponentTransfer%3E%0A%20%20%20%20%20%20%3CfeFuncA%20type%3D%22discrete%22%20tableValues%3D%221%201%22%20/%3E%0A%20%20%20%20%3C/feComponentTransfer%3E%0A%20%20%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BgYICggICAgICAoKCgoKCgoKDAwMDAwMDg4ODg4PDw8PDw8PDw8P/9sAQwECAgIEBAQHBAQHEAsJCxAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQ/9oADAMBAAIRAxEAAAH5te1Ln6H5IPOWlKvXybG0Y+b73aP+ct/Q8hNY7rhvVMztPN9L/9oACAEBAAEFAowzwW5Q5RqhbK3ItqW5uMU9U81qW1qcin//2gAIAQMRAT8BlI24AWB4cuIbnFFiH//aAAgBAhEBPwEQZhnHlhLhm5Jcv//aAAgBAQAGPwL+f//EADMQAQADAAICAgICAwEBAAACCwERACExQVFhcYGRobHB8NEQ4fEgMEBQYHCAkKCwwNDg/9oACAEBAAE/IRiwqNnFLsp3H/jzTUKsc1kWb/gl/9oADAMBAAIRAxEAABBtfpqwj//EADMRAQEBAAMAAQIFBQEBAAEBCQEAESExEEFRYSBx8JGBobHRweHxMEBQYHCAkKCwwNDg/9oACAEDEQE/EOAu9JiOsI4Mv//aAAgBAhEBPxAoMijIlxMT/9oACAEBAAE/EAijBsYvirtovWRQBtJ5Ud2gnR3Uo4f1W2ZqV261YSzn3f/Z%22%0A%20%20%20%20%20%20%20%20%20x%3D%220%22%20y%3D%220%22%0A%20%20%20%20%20%20%20%20%20height%3D%22100%25%22%20width%3D%22100%25%22/%3E%0A%3C/svg%3E%0A');
  background-position: 50% 0;
  background-size: cover;
}

$retina: '(min-resolution: 2dppx)';
$bg-queries: (
  'full': '(min-width: 2561px), only screen and (min-height: 1448px)',
  '2560': '(max-width: 2560px) and (max-height: 1447px)',
  '1200@2x': '(max-width: 2400px) and (max-height: 1356px) and (#{retina})',
  '1200': '(max-width: 1200px) and (max-height: 678px)',
  '992@2x': '(max-width: 1984px) and (max-height: 1121px) and (#{retina})',
  '992': '(max-width: 992px) and (max-height: 561px)',
  '768@2x': '(max-width: 1536px) and (max-height: 868px) and (#{retina})',
  '768': '(max-width: 768px) and (max-height: 434px)'
);

// Safari doesn't seem to support @keyframes inside @media inside @supports, so
// we have to define the animations at the top level
@each $size, $query in $bg-queries {
  @media only screen and #{$query} {
    @keyframes sharpen {
      from {
        background-image: filter(url('http://jacobsmith.io/images/bg-#{$size}.jpg'), blur(40px));
      }

      to {
        background-image: filter(url('http://jacobsmith.io/images/bg-#{$size}.jpg'), blur(0));
      }
    }
  }
}

@supports not (background-image: filter(url('i.jpg'), blur(1px))) {
  html {
    background-size: cover;
  }

  @each $size, $query in $bg-queries {
    @media only screen and #{$query} {
      .is-enhanced {
        background-image: url('http://jacobsmith.io/images/bg-#{$size}.jpg');
      }
    }
  }
}

@supports (background-image: filter(url('i.jpg'), blur(1px))) {
  html {
    will-change: background-image;
  }

  .is-enhanced {
    animation: .5s both sharpen;
  }
}
            
          
!
            
              // Inspired by https://css-tricks.com/the-blur-up-technique-for-loading-background-images/
window.onload = function loadStuff() {
  var bgStyle, bgSrc, bgLoader, img, el, enhancedClass;

  // Quit early if older browser (e.g. IE 8).
  if (!('addEventListener' in window) || !('getComputedStyle' in window)) {
    return;
  }

  el = document.documentElement;
  enhancedClass = 'is-enhanced';

  // this will be a zero-height element to load in the image
  bgLoader = document.createElement('div');
  bgLoader.classList.add(enhancedClass);
  // most browsers won't load the image unless it's actually in the DOM
  document.body.appendChild(bgLoader);
  // Get the image url based on which media query is applying
  bgStyle = getComputedStyle(bgLoader)['background-image'].match(/url\(['"](.+)['"]\)/);
  bgSrc = bgStyle && bgStyle[1];

  img = new Image();

  // instead of just using onload (which fails to fire from time to time),
  // add the src immediately and check for whether the image download is
  // complete before adding the onload handler
  if(bgSrc) {
    img.src = bgSrc;
  }

  function enhance() {
    bgLoader.remove();
    el.classList.add(enhancedClass);
  }

  if(img.complete || img.readyState === 'complete') {
    enhance();
  } else {
    img.onload = enhance;
  }
}
            
          
!
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.
Loading ..................

Console