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

              
                <main>
  <section>
    <div class="content">
      <h1>Blurred background with SVG filters</h1>
    </div>
  </section>
  <section>
    <div class="content">
      <ul>
        <li>
          I used SVG filters for browser support.
        </li>
        <li>
          The effect is comprised of the same fixed image layered on top of itself. The top layer is blurred and darkened.
        </li>
        <li>
          Because filters affect the content of the element, I used absolutely positioned pseudo elements underneath the content.
        </li>
      </ul>
    </div>
  </section>
  <section>
    <div class="content">
      <p>
        Here are some things to allow scrolling.
      </p>
      <img src="http://placehold.it/400x100/eeeeee/666666&text=This+image+is+not+blurred">
      <p>
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus sollicitudin dolor et orci mollis consectetur. Vestibulum neque massa, iaculis eget laoreet at, rutrum et nunc. Etiam faucibus, libero ut feugiat laoreet, velit nunc varius sapien, vitae commodo mi sapien sit amet mauris. Nullam at congue arcu. Mauris faucibus vitae ligula eu fringilla. Proin eget pulvinar eros, non aliquam lectus. Donec ornare, augue eget pellentesque posuere, nulla est imperdiet ipsum, id ullamcorper lacus ipsum nec nulla. Vestibulum ut imperdiet elit, at accumsan elit.
      </p>
      <p>
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus sollicitudin dolor et orci mollis consectetur. Vestibulum neque massa, iaculis eget laoreet at, rutrum et nunc. Etiam faucibus, libero ut feugiat laoreet, velit nunc varius sapien, vitae commodo mi sapien sit amet mauris. Nullam at congue arcu. Mauris faucibus vitae ligula eu fringilla. Proin eget pulvinar eros, non aliquam lectus. Donec ornare, augue eget pellentesque posuere, nulla est imperdiet ipsum, id ullamcorper lacus ipsum nec nulla. Vestibulum ut imperdiet elit, at accumsan elit.
      </p>
      <p>
        An original pen by <a href="https://codepen.io/ejsado/">Eric</a>.
      </p>
    </div>
  </section>
</main>

<svg version="1.1" xmlns="http://www.w3.org/2000/svg">
  <filter id="svgfilter">
    <feGaussianBlur stdDeviation="8" />
		<!-- comment out feComponentTransfer to remove the darkness -->
    <feComponentTransfer>
        <feFuncR type="linear" slope="0.9"/>
        <feFuncG type="linear" slope="0.9"/>
        <feFuncB type="linear" slope="0.9"/>
    </feComponentTransfer>
  </filter>
</svg>
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Oswald:300,400,700);

$svgfilter: url("#svgfilter");

main {
  width: 600px;
  margin: 0 auto;
}
section {
  margin: 70px 0;
  position: relative;
	-moz-border-radius: 20px;
	-webkit-border-radius: 20px;
	border-radius: 20px; /* future proofing */
	-khtml-border-radius: 20px; /* for old Konqueror browsers */
	overflow: hidden;
	/* remove the overflow: hidden to have tapered edges */
}
.content {
  padding: 30px;
}
h1, li, p {
  color: #FFF;
  font-family:'Oswald', 'Arial';
}
h1 {
  text-align: center;
  font-weight: 700;
  letter-spacing: 5px;
  text-transform: uppercase;
}
ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
}
li {
  font-weight: 400;
  padding: 10px 0;
  font-size: 24px;
  letter-spacing: 1px;
}
p {
  font-weight: 300;
  font-size: 18px;
  letter-spacing: 1px;
}
a {
  color: #A3CDF7;
}
body, section::before {
  background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/106891/san-francisco-street.JPG) no-repeat #000;
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
}
section::before {
  content: "";
	display: block;
  z-index: -1;
  -webkit-filter: $svgfilter;
  -moz-filter: $svgfilter;
  -o-filter: $svgfilter;
  -ms-filter: $svgfilter;
  filter: $svgfilter;
  position: absolute;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}
svg {
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

              
            
!

JS

              
                
              
            
!
999px

Console