css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

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

<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>
              body {
	font-family: Georgia, Times New Roman, serif;
	line-height: 1.5;
	margin: 0;

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;
	/* Oddly, this is necessary; without it, the title is covered */
/* 	position: relative; */

.post-header {
	overflow: hidden;
	display: -webkit-flex;
	display: -ms-flexbox;
	display: flex;
	width: 100%;
	height: 54.5vw;
	margin: 0 auto;
	position: relative;

.j {
	position: absolute;
	background-repeat: no-repeat;
	width: 100%;
	height: 100%;
	background-color: #567DA7;
	background-size: cover;
	background-position: 50% 0;

.i {
	background-image: url(data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAYEBAQEBAYEBAYJBgU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Vbfi7ON18u747YnvN2qGXUiE3x7n3s27thpZdAVazOBbPvfa439kDQ8vAVLEDNM+Nvu+pUhmZYl0krKwhNFVbbvvjqXUbTF+ilnnG+V826BzJNEbdI4xjB8ILh5bmyiQ7m+okJHdCmWcwJK/AKVI7Gr4Vg5rNpWxTy799fNC4p6S+ZrW7p8IZZvk2ZqiZWJuodRIQmEkQDGhrO6PvVRd6IKurvu+rS/rgcurrs2kJvzzhv/tBmkU2Okbd1fxH/);
	filter: blur(20px);

.j {
	opacity: 0;

.post-header-enhanced .j {
	transition: all 5s;
	background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/401949/largeimg.jpg);
	opacity: 1;

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

  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.includes(enhancedClass)) {
          // If so, set bgDecl to the entire background-image
          // value of that rule
          bgStyle = styles[i].style.backgroundImage;
          // ...and break the loop.
      // ...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
  img.onerror = function(err) {console.error(err)}

  // Finally, trigger the whole preloading chain by giving the dummy
  // image its source.
  if (bigSrc) { 
    img.src = bigSrc;
🕑 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 ..................