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

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.macbook
  div.screen
    div.editor
      ul.code
        - for (var x = 0; x < 45; x++)
          li
  div.keyboard
              
            
!

CSS

              
                body
  font-size: 62.5%  
  
.macbook
  font-size: 10px
  width: 22em  
  height: 12em  
  position: absolute
  top: 50% 
  left: 50%
  transform: translate(-50%, -50%)
    
  &:before
    content: ""
    display: block  
    position: absolute  
    width: 30em  
    height: 30em  
    background-color: #CAD3D7
    border-radius: 50%
    top: 50%
    left: 50%  
    transform: translate(-50%, -50%)
  
.keyboard
  position: absolute  
  bottom: 0  
  left: 0  
  right: 0  
  background-color: #E2E2E2
  height: 0.55em  
  border-bottom: .25em solid #A5A5A5 
  border-radius: 0 0 .25em .25em
    
.screen
  background-color: #3F3F3F
  position: absolute  
  top: 0  
  left: 1.5em  
  right: 1.5em  
  bottom: .55em
  border-radius: .4em .4em 0 0
  
.editor
  position: absolute  
  top: 0.8em
  left: 0.7em 
  right: 0.8em
  bottom: 0.8em
  background-color: #334D5C
  border-radius: .15em
    
.code
  display: block  
  padding: 1em  
    
  li
    display: block  
    height: .2em  
    width: 2em  
    background-color: #EF5992
    float: left  
    margin: 0 .2em .5em 0
    border-radius: 2em
              
            
!

JS

              
                $(function() {
    $.each($('li'), function(i, code) {
        var max = 5,
            min = 1,
            rand = (Math.floor(Math.random() * max) + min),
            colors = ["#EF5992", "#29BA9C"],
            randcolor = Math.floor(Math.random()*colors.length);
        
      $(code).css({
        'width': rand + "em", 
        "background-color": colors[randcolor]
      });
    });
});
              
            
!
999px

Console