Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

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="home">
  <h1>The gradient will move if you hover.
  </h1>
</div>
              
            
!

CSS

              
                // Boilerplate
@import url('https://fonts.googleapis.com/css?family=Montserrat:500')
.home
  height: 100vh
  display: flex
  text-align: center
  align-items: center
  justify-content: center

h1
  font-family: 'Montserrat', sans-serif
  color: white
  font-size: 42px
  text-align: center
  line-height: 1.56
  text-shadow: 0px 1px 2px rgba(62,57,107,0.4)
  
// Gradient animation
.home
  // Background size that overflows the div allows us to
  // hide a part of the gradient that we can later move into the
  // viewport by doing a background-position movement
  background-size: 200%
  // Because our bg size is 200%, we can define 2 gradients -
  // 1 - from #fe873c to #828dfe which is visible at the start
  // 2 - from #828dfe to #6d58f3 that we can move into the viewport
  background-image: linear-gradient(to bottom left, #fe87c3 0%, #828dfe 50%, #6d58f3 100%)
  // We add a transition to smoothen our the effect
  transition: 600ms ease
  
  // On hover we just move the background position of the div
  // to simulate the switching gradient into the viewport
  // Try hovering the 
  &:hover
    background-position: 100% 0 // We only move the background position
              
            
!

JS

              
                
              
            
!
999px

Console