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 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.

            
              <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
🕑 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 ..................

Console