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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <header class="post-header">
  <h1 class="post-title">A walk along the coast</h1>
</header>

<div class="post-body">
  <p class="post-lede">In July, we went for a walk from the Brösarp hills and out to the coast near Kivik. It was one of the most beautiful days of the summer.</p>

  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quibusdam laudantium eos minima dolor asperiores maxime voluptas itaque iure nostrum quos ipsam aliquam quasi amet repudiandae totam, vel, veniam sit repellat.</p>

  <p>Cum, quibusdam explicabo odit ut voluptatem a, sint ea vel inventore. Earum fugit architecto voluptatem itaque dolorum modi, ipsam, aliquid quod aliquam. Assumenda magnam dolorum quisquam optio dicta ex ipsum ipsa quos, nulla quas eaque, modi fugit
    provident iusto, blanditiis quod dignissimos. Doloribus, natus.</p>

  <p>Perspiciatis hic architecto assumenda quod sit praesentium iure nihil, similique sapiente consequuntur modi dolorum eaque, tenetur sequi perferendis enim, veritatis earum vitae. Veritatis iure nihil perspiciatis, aspernatur reiciendis, esse quia porro
    fuga velit error tenetur quod voluptates recusandae quae provident beatae! Accusamus, ipsum, dolore.</p>

  <p>Commodi nulla, minus repellendus dolores enim eveniet veritatis facere ipsam nemo officia. Culpa veniam a, aperiam at. Consequuntur ducimus mollitia distinctio, perspiciatis! Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ex, cum, vel. Voluptates
    sapiente ipsam error soluta nemo neque nulla tenetur aspernatur consequatur saepe incidunt atque, non, ab nihil similique repudiandae.</p>
</div>
              
            
!

CSS

              
                body {
  font-family: Georgia, Times New Roman, serif;
  line-height: 1.5;
  margin: 0;
}

header,
section,
article,
footer,
aside,
figure {
  display: block;
}

.post-lede {
  font-family: Avenir Next, SegoeUI, Franklin Gothic, arial, sans-serif;
  font-size: 1.25em;
  font-weight: 500;
}

.post-body p {
  margin: 0;
}

.post-body p + p {
  margin-top: 1.5em;
}

.post-body {
  box-sizing: border-box;
  max-width: 50em;
  width: 94%;
  font-size: 1.125em;
  margin: -20vw auto 2em auto;
  padding: 5%;
  position: relative;
  background-color: #fff;
}

.post-title {
  font-family: Avenir Next, SegoeUI, Franklin Gothic, arial, sans-serif;
  text-align: center;
  text-shadow: 0 0 .5em rgba(0, 0, 0, 0.6);
  font-size: calc(1em + 5vw);
  margin: auto auto 23vw;
  padding: .5em;
  color: #fff;
}

.post-header {
  overflow: hidden;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  width: 100%;
  height: 54.5vw;
  margin: 0 auto;
  background-color: #567DA7;
  background-size: cover;
  background-position: 50% 0;
  background-image: url(data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20width%3D%221500%22%20height%3D%22823%22%20viewBox%3D%220%200%201500%20823%22%3E%0A%20%20%3Cfilter%20id%3D%22blur%22%20color-interpolation-filters%3D%22sRGB%22%3E%0A%20%20%20%20%3CfeGaussianBlur%20stdDeviation%3D%2220%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%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O3RVBBXPWDfjEeifryN3VKxp+n4eeZtlraFwJrTaAW35kxbfxrHPTo7nEj67RjSbP2gCgDK2OLEejEWpp2DGxHYAYlWMuyYEXm2dniwhmbQ/vbeIDVe0rfopfvL5o0YkUnGY30PhHWXG0y47DHqtRNSwtfpVNfaCgVbfi7ON18u747YnvN2qGXUiE3x7n3s27thpZdAVazOBbPvfa439kDQ8vAVLEDNM+Nvu+pUhmZYl0krKwhNFVbbvvjqXUbTF+ilnnG+V826BzJNEbdI4xjB8ILh5bmyiQ7m+okJHdCmWcwJK/AKVI7Gr4Vg5rNpWxTy799fNC4p6S+ZrW7p8IZZvk2ZqiZWJuodRIQmEkQDGhrO6PvVRd6IKurvu+rS/rgcurrs2kJvzzhv/tBmkU2Okbd1fxH/2Q%3D%3D%22%20x%3D%220%22%20y%3D%220%22%20height%3D%22100%25%22%20width%3D%22100%25%22/%3E%0A%3C/svg%3E);
}

.post-header-enhanced {
  background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/401949/largeimg.jpg);
}

@supports (background-image: filter(url('i.jpg'), blur(1px))) {
  .post-header {
    transform: translateZ(0);
  }
  .post-header-enhanced {
    animation: sharpen .5s both;
  }
  @keyframes sharpen {
    from {
      background-image: filter(url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/401949/largeimg.jpg), blur(20px));
    }
    to {
      background-image: filter(url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/401949/largeimg.jpg), blur(0px));
    }
  }
}
              
            
!

JS

              
                window.onload = function loadStuff() {
  var win, doc, img, header, enhancedClass;
  // Quit early if older browser (e.g. IE8).
  if (!('addEventListener' in window)) {
    return;
  }

  win = window;
  doc = win.document;
  img = new Image();
  header = doc.querySelector('.post-header');
  enhancedClass = 'post-header-enhanced';

  // Rather convoluted, but parses out the first mention of a background
  // image url for the enhanced header, even if the style is not applied.
  var bigSrc = (function() {
    // Find all of the CssRule objects inside the inline stylesheet 
    var styles = doc.querySelector('style').sheet.cssRules;
    // Fetch the background-image declaration...
    var bgDecl = (function() {
      // ...via a self-executing function, where a loop is run
      var bgStyle, i, l = styles.length;
      for (i = 0; i < l; i++) {
        // ...checking if the rule is the one targeting the
        // enhanced header.
        if (styles[i].selectorText &&
          styles[i].selectorText == '.' + enhancedClass) {
          // If so, set bgDecl to the entire background-image
          // value of that rule
          bgStyle = styles[i].style.backgroundImage;
          // ...and break the loop.
          break;
        }
      }
      // ...and return that text.
      return bgStyle;
    }());
    // Finally, return a match for the URL inside the background-image
    // by using a fancy regex i Googled up, if the bgDecl variable is
    // assigned at all.         
    return bgDecl && bgDecl.match(/(?:\(['|"]?)(.*?)(?:['|"]?\))/)[1];
  }());

  // Assign an onLoad handler to the dummy image *before* assigning the src
  img.onload = function() {
    header.className += ' ' + enhancedClass;
  };
  // Finally, trigger the whole preloading chain by giving the dummy
  // image its source.
  if (bigSrc) {
    img.src = bigSrc;
  }
};
              
            
!
999px

Console