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

              
                # [Kumquats Happy To Say “Baggy Pants”][1]

## [Dialogue][1] From Hamlet

### [Night (Not Day)][1]

Well, [good night][1].

Bernardo has my place.  
Give [you *good night*][1].

You come most [carefully upon your][1] hour.

[Have you][1] had [quiet guard][1]?

What, has this [thing appear’d][1] again *[to-night][1]?*

Sit down awhile;  
And let us [once again][1] assail your ears,  
That are so fortified [against our story][1]  
What we have **[two nights][1]** seen.

To be, or not to be: that is *[the question:][1]*  
Whether ’tis nobler in the mind to suffer  
The [slings][1] and arrows of [outrageous fortune][1],  
Or to [take arms against][1] a sea of troubles,  
And [by opposing][1] end them? To die: to sleep;  
No more; and by a [**sleep** to say][1] we end  
The heart-ache and the thousand natural shocks  
That flesh is heir to, ’tis a consummation  
[Devoutly][1] to be wish’d.

<button class="toggle-underline-class">Enable custom text underline</button>
<button class="toggle-font-family">Switch to sans-serif font</button>

[1]: http://shakespeare.mit.edu/hamlet/full.html

              
            
!

CSS

              
                // Colors
$color-accent     : rgb(141, 179, 89);
$color-text-body  : rgb(87, 83, 74);
$color-text-light : rgb(184, 186, 188);
$color-ui-light   : lighten($color-text-light, 14%);
// Font stacks
$font-sans-serif  : "Helvetica Neue", Helvetica, sans-serif;
$font-serif       : Georgia, serif;

// Set up basic typography
body {
  // 16px * 106.25% = 17px
  font-size: 106.25%;
  color: $color-text-body;
  font-family: $font-serif;
  font-weight: 400;
  padding: 0 1.5em 1.5em;
  &.is-sans-serif {
    font-family: $font-sans-serif;
  }
}
a {
  color: $color-accent;
}

// Custom link underline
// ---------------------
.has-custom-underline {
  a {
    color: $color-accent;
    text-decoration: none;
    // Underline via gradient background
    background-image: linear-gradient(rgba($color-accent, 0.25) 0%, $color-accent 100%);
    background-repeat: repeat-x; 
    background-size: 1px 1px;
    background-position: 0 95%;
    // Tweak position + thickness for high res (1.75x and up) displays
    @media (-webkit-min-device-pixel-ratio: 1.75), 
           (min-resolution: 168dpi) {
      background-image: linear-gradient(rgba($color-accent, 0.25) 0%, $color-accent 100%);
      background-position: 0 93%;
    }
    // Clear descendors from underline
    text-shadow: 3px 0 white, 2px 0 white, 1px 0 white, -1px 0 white, -2px 0 white, -3px 0 white;
    &:hover {
      color: darken($color-accent, 11%);
      background-image: linear-gradient(to bottom, darken($color-accent, 6%) 0%, darken($color-accent, 6%) 100%);
    }
    // Style selected links (or else text-shadow makes it look crazy ugly)
    // Pseudo selectors must go separately, or they break each other
    &,
    > * {
      &::selection {
        background-color: lighten($color-accent, 25%);
        color: $color-text-body;
        text-shadow: none;
      }
      &::-moz-selection {
        background-color: lighten($color-accent, 25%);
        color: $color-text-body;
        text-shadow: none;
      }
    }
  }
  h1, h2, h3 {
    a {
      background-size: 1px 2px;
      @media (-webkit-min-device-pixel-ratio: 1.75), 
             (min-resolution: 168dpi) {
        background-position: 0 93%;
        background-image: linear-gradient($color-accent 0%, $color-accent 100%);
        background-size: 1px 1px;
        background-position: 0 93%;
      }
    }
  }
}

// Toggle buttons
// --------------
button {
  position: fixed;
  right: 1.5em;
  background: $color-ui-light;
  border: 0;
  padding: 0.25em 0.75em;
  color: $color-text-body;
  font-family: $font-sans-serif;
  font-size: 0.94em;
}
.toggle-underline-class {
  top: 5em;
  @media (min-width: 975px) {
    top: 2em;
  }
}
.toggle-font-family {
  top: 7.5em;
  @media (min-width: 975px) {
    top: 4.5em;
  }
}
              
            
!

JS

              
                (function(body) {
  var underline_class   = ' has-custom-underline',
      font_family_class = ' is-sans-serif';
  document.getElementsByClassName('toggle-underline-class')[0].addEventListener('click', function() {
    if (body.className.indexOf(underline_class) > -1) {
      body.className = body.className.replace(underline_class, '');
      this.innerHTML = this.innerHTML.replace('Disable', 'Enable');
    } else {
      body.className += underline_class;
      this.innerHTML = this.innerHTML.replace('Enable', 'Disable');
    }
  });
  document.getElementsByClassName('toggle-font-family')[0].addEventListener('click', function() {
    if (body.className.indexOf(font_family_class) > -1) {
      body.className = body.className.replace(font_family_class, '');
      this.innerHTML = this.innerHTML.replace('serif', 'sans-serif');
    } else {
      body.className += font_family_class;
      this.innerHTML = this.innerHTML.replace('sans-serif', 'serif');
    }
  });
})(document.body);
              
            
!
999px

Console