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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <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>
            
          
!
            
              /* Stretch out the two pseudo-elements across the entirety of their parent element */
header::before,
header::after {
  content: "";
  display: block;
  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;
}
            
          
!
            
              /* 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
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console