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

              
                <h1>Icons</h1>


<hr />


<h2>Icon Treatment, All Sizes and Fills</h2>

<h3>Small, Solid</h3>

<button class="button button--primary button--small button--solid button--icon">
  <svg aria-hidden="true" class="icon-download"><use xlink:href="#icon-download"></use></svg>
  <span>Download</span>
</button>

<button class="button button--secondary button--small button--solid button--icon">
  <svg aria-hidden="true" class="icon-download"><use xlink:href="#icon-download"></use></svg>
  <span>Download</span>
</button>

<button class="button button--tertiary button--small button--solid button--icon">
  <svg aria-hidden="true" class="icon-download"><use xlink:href="#icon-download"></use></svg>
  <span>Download</span>
</button>

<h3>Medium, Solid</h3>

<button class="button button--primary button--medium button--solid button--icon">
  <svg aria-hidden="true" class="icon-download"><use xlink:href="#icon-download"></use></svg>
  <span>Download</span>
</button>

<button class="button button--secondary button--medium button--solid button--icon">
  <svg aria-hidden="true" class="icon-download"><use xlink:href="#icon-download"></use></svg>
  <span>Download</span>
</button>

<button class="button button--tertiary button--medium button--solid button--icon">
  <svg aria-hidden="true" class="icon-download"><use xlink:href="#icon-download"></use></svg>
  <span>Download</span>
</button>

<h3>Large, Solid</h3>

<button class="button button--primary button--large button--solid button--icon">
  <svg aria-hidden="true" class="icon-download"><use xlink:href="#icon-download"></use></svg>
  <span>Download</span>
</button>

<button class="button button--secondary button--large button--solid button--icon">
  <svg aria-hidden="true" class="icon-download"><use xlink:href="#icon-download"></use></svg>
  <span>Download</span>
</button>

<button class="button button--tertiary button--large button--solid button--icon">
  <svg aria-hidden="true" class="icon-download"><use xlink:href="#icon-download"></use></svg>
  <span>Download</span>
</button>

<h3>Small, Hollow</h3>

<button class="button button--primary button--small button--hollow button--icon">
  <svg aria-hidden="true" class="icon-download"><use xlink:href="#icon-download"></use></svg>
  <span>Download</span>
</button>

<button class="button button--secondary button--small button--hollow button--icon">
  <svg aria-hidden="true" class="icon-download"><use xlink:href="#icon-download"></use></svg>
  <span>Download</span>
</button>

<button class="button button--tertiary button--small button--hollow button--icon">
  <svg aria-hidden="true" class="icon-download"><use xlink:href="#icon-download"></use></svg>
  <span>Download</span>
</button>

<h3>Medium, Hollow</h3>

<button class="button button--primary button--medium button--hollow button--icon">
  <svg aria-hidden="true" class="icon-download"><use xlink:href="#icon-download"></use></svg>
  <span>Download</span>
</button>

<button class="button button--secondary button--medium button--hollow button--icon">
  <svg aria-hidden="true" class="icon-download"><use xlink:href="#icon-download"></use></svg>
  <span>Download</span>
</button>

<button class="button button--tertiary button--medium button--hollow button--icon">
  <svg aria-hidden="true" class="icon-download"><use xlink:href="#icon-download"></use></svg>
  <span>Download</span>
</button>

<h3>Large, Hollow</h3>

<button class="button button--primary button--large button--hollow button--icon">
  <svg aria-hidden="true" class="icon-download"><use xlink:href="#icon-download"></use></svg>
  <span>Download</span>
</button>

<button class="button button--secondary button--large button--hollow button--icon">
  <svg aria-hidden="true" class="icon-download"><use xlink:href="#icon-download"></use></svg>
  <span>Download</span>
</button>

<button class="button button--tertiary button--large button--hollow button--icon">
  <svg aria-hidden="true" class="icon-download"><use xlink:href="#icon-download"></use></svg>
  <span>Download</span>
</button>
              
            
!

CSS

              
                ///////////////////////////////
// ELEMENT LOGIC             //
// Element starts on line 35 //
///////////////////////////////

// Breakpoints:
$bp-lap: 37.5em;  // 600px @ 16px

// Background variables
$background: #fefbef;

// Color variables
$type-light: $background;
$type-dark: #403f3c;
$button-color-primary-light: #ff4136;
$button-color-secondary-light: #357edd;
$button-color-tertiary-light: #808080;

// Border variables
$button-border-width-thin: 2px;
$button-border-width-thick: 3px;








/////////////////////
// ELEMENT STYLING //
/////////////////////

// Declared as a class so we can easily apply it to both `<button>` and `<input type="button">`
.button {

  /////////////////////
  // CORE FORMATTING //
  /////////////////////
  background-color: transparent;
  border: 0;
  color: $type-light;
  font-family: 'Open Sans', sans-serif;
  font-weight: 600;
  line-height: 1;
  margin-top: 1.5rem;
  width: 100%; // Large, mobile-friendly touch target

  // Media Queries
  @media (min-width: $bp-lap) {
    width: auto; // Smaller buttons on larger screens
    padding-left: 2rem;
    padding-right: 2rem;
    margin-left: 1rem;
    margin-right: 1rem;
  }

  ////////////////
  // PRIORITIES //
  ////////////////
  // Primary buttons
  // `#{&}` interpolates the ampersand selector, letting you target multiple classes on the same element: https://webdesign.tutsplus.com/tutorials/all-you-ever-need-to-know-about-sass-interpolation--cms-21375  
  &--primary#{&}--solid {
    background-color: $button-color-primary-light;
  }

  &--primary#{&}--hollow {
    color: $button-color-primary-light;
    border: $button-border-width-thick solid $button-color-primary-light;
  }

  // Secondary buttons
  &--secondary#{&}--solid {
    background-color: $button-color-secondary-light;
  }

  &--secondary#{&}--hollow {
    color: $button-color-secondary-light;
    border: $button-border-width-thick solid $button-color-secondary-light;
  }

  // Tertiary buttons
  &--tertiary#{&}--solid {
    background-color: $button-color-tertiary-light;
  }

  &--tertiary#{&}--hollow {
    color: $button-color-tertiary-light;
    border: $button-border-width-thick solid $button-color-tertiary-light;
  }

  ///////////
  // SIZES //
  ///////////
  &--small {
    min-width: 6rem;
    border-radius: 0.5rem;
    font-size: 0.8em;
    min-height: 2rem;
  }

  &--small#{&}--hollow {
    border-width: $button-border-width-thin;
  }

  &--small#{&}--icon {
    [class^="icon-"] {
      height: 0.8rem;
      margin-right: 0.2rem;
      position: relative;
       top: 0.125rem;
      width: 0.8rem;
    }
  }

  &--medium {
    min-width: 8rem;
    border-radius: 0.75rem;
    min-height: 2.5rem;
  }

  &--medium#{&}--icon {
    [class^="icon-"] {
      height: 1rem;
      margin-right: 0.3rem;
      position: relative;
       top: 0.125rem;
      width: 1rem;
    }
  }

  &--large {
    min-width: 10rem;
    border-radius: 0.75rem;
    font-size: 1.2em;
    letter-spacing: 1px;
    min-height: 3rem;
  }

  &--large#{&}--icon {
    [class^="icon-"] {
      height: 1.1rem;
      margin-right: 0.35rem;
      position: relative;
       top: 0.1875rem;
      width: 1.1rem;
    }
  }
}








/////////////////////
// PAGE FORMATTING //
/////////////////////
body {
  color: $type-dark;
  padding: 3rem;
  background-color: $background;
}

h1,
h2,
h3 {
  margin: 0;
  padding: 0;

  // Contexts
  .background--dark & {
    color: $type-light;
  }
}

h1 {
  font-size: 1.5em;
  font-weight: 600;
}

h2 {
  font-size: 1em;
  font-weight: 400;
}

h3 {
  font-size: 0.9em;
  font-weight: 400;
  letter-spacing: 1px;
  margin-top: 2.5em;
  text-transform: uppercase;
}

hr {
  border: 1px solid $type-dark;
  margin-top: 2.5rem;
}

// SVG Icons
// This controls the default behavior of how icons look when they're declared via the `<use>` tag
[class^="icon-"],
[class*=" icon-"] {
  display: inline-block;
  width: 1em;
  height: 1em;
  stroke-width: 0;
  stroke: currentColor;
  fill: currentColor;
}
              
            
!

JS

              
                  // Applies the class `.background` to `<body>` when the page loads
$(document).ready(function() {
  $('body').addClass('background');
});

              
            
!
999px

Console