cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

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.

            
              <div class="container">
  <p>As I was building Fleggo and an earlier version of my site, I wanted to take advantadge of the concept of blurred background images. I wanted the ability to have a crystal clear photo that is blurred and not two images loaded. In order to accomplish this, I needed to use the blur filter in CSS. The issue with this, is it blurs not just the node you apply it to, but all it's children.</p>
  <p> My solution was to use pseudo elements. This also offered the nice thing of progressive enhancement. By using a pseudo element and applying the blur to it, if the pseudo element or blur wasn't supported, we'd still have a pleasing background image. This demo shows how it looks, and if you click button, you can see the layers.</p>
  <button name="trigger" id="trigger">View Layers</button>
  <div class="hero">
    <div class="hero_content">
      <h1>Title</h1>
    </div>
  </div>
  
</div>
            
          
!
            
              $img: '//c4.staticflickr.com/8/7482/15936822330_948779c621_n.jpg'
.container
  width: 600px
  height: 300px
  margin: 0 auto
  text-align: center
  p
    text-align: left
    margin: 10px 10px 20px 10px
.hero
  background:
    image: url($img)
    size: 120%
    repeat: no-repeat
  height: 300px
  width: 600px
  position: relative
  transition: all ease 500ms
  margin: 30px 0
  &:after
    background:
      image: url($img)
      size: 100%
      repeat: no-repeat
    height: 310px
    width: 610px
    position: absolute
    top: -5px
    left: -5px
    content: ' '
    -webkit-filter: blur(5px)
    transition: all ease 500ms
.hero_content
  position: relative
  z-index: 1
  padding: 20px
  font-size: 50px
  text-shadow: 0 1px 5px rgba(0,0,0,.5)
  transition: all ease 500ms
.hero.trigger
  box-shadow: 0 10px 5px rgba(0,0,0,.5)
  transform: rotateY(50deg) rotateX(10deg)
  &:after
    transform: rotateY(50deg) rotateX(10deg) translateY(75px)
    box-shadow: 0 10px 5px rgba(0,0,0,.5)
    
  .hero_content
    transform: rotateY(50deg) rotateX(10deg) translateY(250px)
    text-shadow: 0 10px 5px rgba(0,0,0,.5)
    
            
          
!
            
              $('#trigger').on('click', function(e){
  e.preventDefault();
  $('.hero').toggleClass('trigger');
});
            
          
!
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