Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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>
  <h1>
    You won’t believe these 17 “articles” our editors thought were good enough to publish
    <small>p.s. let us track you ok bye</small>
  </h1>
  
  
  <p>Want to get into journalism? Better learn how to search for “relatable meme GIFs,” as you'll see in this hard-hitting exposé…</p>
</header>
              
            
!

CSS

              
                /* Stretch out the two pseudo-elements across the entirety of their parent element */
header::before,
header::after {
  content: "";
  position: absolute;
  width: 100%; height: 100%;
  left: 0; top: 0;
}

header::before {
  background: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/183091/Black_and_white_branch.jpg");
  
  /* Specified separately for older versions of Android/Safari that choke on background-size when used inside the `background` shorthand property. */
  background-size: cover;
  
  /* Move underneath the backdrop's content. */
  z-index: -2;
  
  filter: blur(5px) brightness(0.75);
  
  /* Make it a little bigger to avoid the white bleeding from the edges that the `blur()` filter produces. */
  transform: scale(1.07);
}

header::after {
  z-index: -1;
  background: rgba(0,0,0, 0.5);
  /* If filters are unsupported, then this fallback color wash remains to make sure the text stays legible. Test this pen in IE! */
  filter: opacity(0);
}

/* * * Now for some styling that's not related to this trick. * * */

html,
body,
header {
  height: 100%;
  margin: 0;
}

body {
  color: #fff;
  display: table;
  
  /* This is a trick to make viewport-unit-sized text zoomable, see https://codepen.io/AmeliaBR/details/RNXeyd/ */
  font-size: calc(0.5em + 2vmin);
  overflow: hidden;
}

header {
  display: table-cell;
  padding: 0.5em;
  position: relative;
  vertical-align: middle;
}

h1 {
 text-align: center;
 text-transform: uppercase;
}

small {
  display: block;
  font-size: 70%;
  margin: 0.75em;
  opacity: 0.8;
}

p {
  max-width: 25em;
  margin: 1em auto;
}
              
            
!

JS

              
                /* Image credit: https://commons.wikimedia.org/wiki/File:Black_and_white_branch.jpg */

/*
  Explanation of what's going on in this pen: https://codepen.io/tigt/post/blurred-background-image-with-fallback
*/
              
            
!
999px

Console