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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nihil earum maiores vitae libero ad soluta distinctio iure illum cupiditate illo aliquam quidem a enim perferendis velit consequatur natus quae molestias?</p>
<h2>Level 2 heading</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsa laboriosam assumenda natus alias quaerat impedit error dolorem consequatur vel aliquid esse maxime inventore et a sapiente tempora perferendis quidem deleniti.</p>
              
            
!

CSS

              
                @import "compass/css3";

// Config
$base-line-height:     24;
$base-font-size:       16;

$rhythm-unit:          $base-line-height;

$guide-color:          #FF6BA6;

// Return an em value based on the $base-font-size or contextual size. Thanks @ijy https://gist.github.com/ijy/1441967
@function em($target, $context: $base-font-size) {
   @if $target == 0 { @return 0 }
   @return $target / $context + 0em;
}

// Generate a baseline guide equal to the rhythm unit
@mixin baseline-guide {
	@include background-image(linear-gradient($guide-color 1px, transparent 1px));
	background-size: 100% em($rhythm-unit);
}

// Calculate an em font size based on the base font size or passed context. If $line-height is true, set a line height equal to a multiple of the rhythm unit. Thanks @csswizardry & @redclov3r: https://github.com/csswizardry/inuit.css/blob/7dbc892f8d298795e19aeb64d1369ae3271561d1/generic/_mixins.scss
@mixin font-size($font-size, $context: $base-font-size, $line-height: false){
    font-size: ($font-size)*1px; 
    font-size: ($font-size / $context)*1em;
    @if $line-height == true{
        line-height:ceil($font-size / $rhythm-unit) * ($rhythm-unit / $font-size);
    }
}

// Simple reset to remove default margins
* {
  margin: 0;
}

// Apply the base font size, base line height, and baseline guide
html {
  	font-size: $base-font-size*1px;
  	line-height: $base-line-height/$base-font-size;
  	@include baseline-guide;
}

p {
  // Add margin bottom equal to 1 rhythm unit
  margin-bottom: em($rhythm-unit);
}

h2 {
  // Change the h2 font size and set the line height to match the rhythm
  @include font-size(32, $line-height: true);
  // Add margin bottom equal to 1 rhythm unit
  margin-bottom: em($rhythm-unit, 32);
}
              
            
!

JS

              
                
              
            
!
999px

Console