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

              
                .hero
  h1 Some other text
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Lemon)
  
*
  box-sizing border-box
  padding 0
  margin 0
  
html
body
  height 100%

.hero
  position relative
  background-image url(http://lorempizza.com/800/600)
  background-size cover
  width 100%
  height 100%
  opacity 0
  transition opacity .5s
  
  &.ready
    opacity 1
    
    h1
      display none

  h1
    position absolute
    top 50%
    left @top
    transform translate(-50%, -50%)
    color white
    font-family Lemon, sans-serif
  
  canvas
    position absolute
    top 0
    left 0
              
            
!

JS

              
                var hero = document.querySelector(".hero"),
    heading = hero.querySelector("h1"),
    canvas = document.createElement("canvas"),
    ctx = canvas.getContext("2d");

canvas.width = hero.clientWidth;
canvas.height = hero.clientHeight;

setTimeout(function () {
  ctx.fillStyle = "rgba(0, 0, 0, .8)";
  ctx.fillRect(0, 0, canvas.width, canvas.height);
  ctx.font = "80px Lemon";
  ctx.fillStyle = "rgba(0, 0, 0, 1)";
  ctx.globalCompositeOperation = "destination-out";
  ctx.fillText(heading.innerText, canvas.width / 4, canvas.height / 2);

  hero.appendChild(canvas);

  hero.className = "hero ready";
}, 1000);
              
            
!
999px

Console