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

              
                <div class="container">
  <h1 class="element--description">Hey look</h1>
  
  <a class="element--hover">
    Hover me
  </a>
</div>

<div class="info">
  <p>Inspired by Andrew Spencer's multiple shadows</p>
  <p>Here's a <a href="https://codepen.io/iam_aspencer/pen/xXQbvK">demo</a> of how they built their hover effect </p>      
</div>
              
            
!

CSS

              
                body {
  margin: 0; // Reset
}

.container {
  height: 98vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #369fbe;
  
  padding: 0;
  margin: 0;
}

.element--description,
.element--hover {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 1.25rem;
  text-transform: uppercase;
  color: #fff;
  
  background-color: #369fbe;
  
  padding: 2rem 4rem;
  border-radius: 8rem; // Curved corners
}

.element--description {
  margin-right: 4rem;
  
  // Here's where the shadow 🎉 happens
  // Esentially this is built using a series of slightly
  // different shadows. You can change these around to move
  // the "lighting" on the page. As a rule of thumb, the furter
  // a shadow is from the object, the more blur it should have.
  box-shadow: 0 4px  4px  rgba(0, 0, 0, .1),
              0 1px  6px  rgba(0, 0, 0, .05),
              0 8px  8px  rgba(0, 0, 0, .1), 
              0 16px 16px rgba(0, 0, 0, .1), 
              8px 32px 32px rgba(0, 0, 0, .15), 
              8px 64px 64px rgba(0, 0, 0, .15);
}

.element--hover {
  cursor: pointer;
  
  transition: box-shadow 600ms cubic-bezier(.33,.11,.02,.99),
              transform  600ms cubic-bezier(.33,.11,.02,.99);
  
  // The dynamic hover effect
  &:hover {
   box-shadow: 0 4px  4px  rgba(0, 0, 0, .1),
               0 1px  6px  rgba(0, 0, 0, .05),
               0 8px  8px  rgba(0, 0, 0, .1), 
               0 16px 16px rgba(0, 0, 0, .1), 
               8px 32px 32px rgba(0, 0, 0, .15), 
               8px 64px 64px rgba(0, 0, 0, .15); 

    transform: scale(1.05)
               translateY(-0.5rem);
  }
  
  
  &:active {
   box-shadow: 0 4px  4px  rgba(0, 0, 0, .1),
               0 1px  6px  rgba(0, 0, 0, .05),
               0 8px  8px  rgba(0, 0, 0, .1), 
               0 16px 16px rgba(0, 0, 0, .1), 
               8px 16px 16px rgba(0, 0, 0, .15), 
               8px 32px 32px rgba(0, 0, 0, .15); 
  }
}

.info {
  min-height: 20vh;
  background-color: darken(#2f87a1, 10%);
  
  font-family: 'Josefin Sans', sans-serif;
  color: #aaaaee;
  text-align: center;
  
  padding: 2rem;
  margin: 0;
  
  a {
    color: #ddd;
    text-decoration: none;
    border-bottom: solid #ddd 1px;
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console