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.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

            
              
.button Hover me

.bg-1
.bg-2

            
          
!

CSS

            
              
body
  background-color: #000

.button
  display: inline-block
  position: fixed
  top: 50%
  left: 50%
  z-index: 2
  border: 2px solid rgba(#fff, 0.6)
  padding: 20px 32px
  transform: translate(-50%, -50%)
  font-family: sans-serif
  text-transform: uppercase
  color: rgba(#fff, 0.8)
  cursor: pointer
  transition: border-color 0.5s, background-color 0.5s, color 0.5s

  &:hover
    background-color: #fff
    border-color: transparent
    color: #444

    ~ .bg-1
      opacity: 0

    ~ .bg-2
      // To darken the picture I'm using only 70% opacity and
      // a black background color
      opacity: 0.7

$bg
  position: fixed
  top: 0
  left: 0
  z-index: 1
  width: 100%
  height: 100%
  background-repeat: no-repeat
  background-position: center center
  transition: opacity 1s

.bg-1
  @extends $bg
  background-image: url('//lorempixel.com/g/1920/1200/nature/5/')
  opacity: 0.6

.bg-2
  @extends $bg
  background-image: url('//lorempixel.com/g/1920/1200/animals/3/')
  opacity: 0

            
          
!

JS

            
              /*

  Unfortunately, this method is somewhat impractical as you
  have to place background elements after the button and set
  a smaller z-index which requires absolute/fixed positioning.
  Still, not that big of a deal with only a few elements
  and it looks cool.

  ---

  Changelog:

  4/10/2016
  * Figured out I wasn't that bright while writing
    the original code
  * Cleaned and improved the code
  * Changed Slim to Jade and Sass to Stylus - not because
    they're better or anything, I just wanted to
  * Spent a few minutes to come up with some clever changelog
    message

  12/9/2014
  * Made some miscellaneous improvements
  * Cleaned the code even, even more

  9/20/2014
  * Improved fallback for larger resolutions
  * Cleaned the code even more

  9/17/2014
  * Translated HTML to Slim and CSS to Sass for easier
    editing
  * Made some small fixes and removed headers
  * Fixed the images again

  6/7/2014
  * Fixed the images

*/
            
          
!
999px

Console