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

              
                <ul>
  <li><button class="c-btn">Button</button></li>
  <li>
    <button class="c-btn">
      <span class="c-btn__text">More</span>

      <?xml version="1.0" encoding="UTF-8"?>
      <svg class="c-btn__icon" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
          <title>Plus</title>
          <g id="Page-1" stroke="none" stroke-width="1" fill-rule="evenodd">
              <g id="plus" fill-rule="nonzero">
                  <path d="M15.5,7 L9,7 L9,0.5 C9,0.224 8.776,0 8.5,0 L7.5,0 C7.224,0 7,0.224 7,0.5 L7,7 L0.5,7 C0.224,7 0,7.224 0,7.5 L0,8.5 C0,8.776 0.224,9 0.5,9 L7,9 L7,15.5 C7,15.776 7.224,16 7.5,16 L8.5,16 C8.776,16 9,15.776 9,15.5 L9,9 L15.5,9 C15.776,9 16,8.776 16,8.5 L16,7.5 C16,7.224 15.776,7 15.5,7 Z" id="Shape"></path>
              </g>
          </g>
      </svg>

    </button><!-- end c-btn -->
  </li>
  <li>
    <button class="c-btn ">
      <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg class="c-btn__icon" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 15 16">
<path d="M15 13l-3.893-3.893c0.556-0.907 0.893-1.964 0.893-3.107 0-3.313-2.688-6-6-6s-6 2.687-6 6c0 3.313 2.687 6 6 6 1.143 0 2.2-0.337 3.107-0.891l3.893 3.891c0.273 0.273 0.727 0.271 1 0l1-1c0.273-0.273 0.273-0.727 0-1zM6 10c-2.209 0-4-1.791-4-4s1.791-4 4-4 4 1.791 4 4-1.791 4-4 4z"></path>
</svg>

      <span class="c-btn__text">Search</span>
    </button><!-- end c-btn -->
  </li>
  <li>
    <button class="c-btn ">
        <?xml version="1.0" encoding="UTF-8"?>
        <svg class="c-btn__icon" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
            <title>Plus</title>
            <g id="Page-1" stroke="none" stroke-width="1" fill-rule="evenodd">
                <g id="plus" fill-rule="nonzero">
                    <path d="M15.5,7 L9,7 L9,0.5 C9,0.224 8.776,0 8.5,0 L7.5,0 C7.224,0 7,0.224 7,0.5 L7,7 L0.5,7 C0.224,7 0,7.224 0,7.5 L0,8.5 C0,8.776 0.224,9 0.5,9 L7,9 L7,15.5 C7,15.776 7.224,16 7.5,16 L8.5,16 C8.776,16 9,15.776 9,15.5 L9,9 L15.5,9 C15.776,9 16,8.776 16,8.5 L16,7.5 C16,7.224 15.776,7 15.5,7 Z" id="Shape"></path>
                </g>
            </g>
        </svg>

    </button><!-- end c-btn -->
  </li>
  <li>
    <button class="c-btn">This Is Extra Super Long Button Text</button>
  </li>
  <li>
    <button class="c-btn c-btn--secondary">Button</button>
  </li>
  <li>
    <button class="c-btn c-btn--large">Button</button></li>
  <li>
    <button class="c-btn c-btn--small">Button</button>
  </li>
  <li>
    <button class="c-btn c-btn--block">Button</button>
  </li>
</ul>











<select class="theme-switcher">
    <option value="default">Select A Theme</option>
    <option value="theme-1">Theme 1</option>
    <option value="theme-2">Theme 2</option>
    <option value="theme-3">Theme 3</option>
    <option value="theme-4">Theme 4</option>
    <option value="theme-5">Theme 5</option>
</select>







              
            
!

CSS

              
                /*------------------------------------*\
    #DESIGN TOKENS
\*------------------------------------*/
:root {
  /**
   * First tier: brand definitions
   * 1) These variables define the brand. We're looking for 
   *    generic delclarations like "brand-blue", "brand-purple", and 
   *    so on. They should not imply usage. 
   */
  --theme-1-font-family-primary: 'Oswald', sans-serif; 
  --theme-1-color-brand-pink: #fe366a;
  --theme-1-color-brand-pink-deep: #d71346;
  --theme-1-color-white: #fff;
  
  /**
   * Theme 2 Brand Definition
   * 1) In a real environment, these definitions would live 
   *    in a separate file 
   */
  --theme-2-font-family-primary: 'Merriweather', serif; 
  --theme-2-color-brand-green: #317c2f;
  --theme-2-color-white: #fff;
  --theme-2-color-gray-10: #e5e5e5;
  --theme-2-color-gray-50: #808080;
  
  /**
   * Second tier: global variables 
   * 1) At this tier you can define global values, such as "primary          
   *    color, secondary color, primary text color, action color, 
   *    default spacing values, and so on. These values help map the    
   *    brand variable definitions to actual utility. That said, these
   *    values should not include component-specific values like 
   *    navigation-link-color. Those will be handled at the individual
   *    component level.
   */
  --theme-1-color-primary: var(--theme-1-color-brand-pink);
  --theme-1-color-primary-tone: var(--theme-1-color-brand-pink-deep);
  --theme-1-text-light: var(--theme-1-color-white);
}







/*------------------------------------*\
    #BUTTONS
\*------------------------------------*/

/**
 * Default variables 
 * 1) These can be seen as the "vanilla" button styles for the design   
 *    system. These define the necessary variables for each component,
 *    and applies a basic, "boring" aesthetic to it. 
 */
:root {
	--button-background-color: #333;
	--button-text-color: #fff;
  --button-font-family: Helvetica, sans-serif;
	--button-font-size: 1rem;
	--button-font-weight: 400;
	--button-border-width: 1px;
	--button-border-style: solid;
	--button-border-color: #333;
	--button-border-radius: 0;
	--button-padding: 1rem 2rem;
	--button-text-transform: normal;
	--button-letter-spacing: initial;
	--button-icon-width: 1rem;
	--button-icon-height: 1rem;
	--button-icon-color: currentColor;
  --button-transition: all 0.1 ease-out;
}

/**
 * Theme 1 button styles
 * 1) Here we map the theme's second-tier global variables to the
 *    specific components.
 * 2) Worth noting in a production environment the :root variables
 *    would be updated rather than a theme-specific body class.
 */
.theme-1 {
	--button-background-color: var(--theme-1-color-primary);
	--button-border-color:  var(--theme-1-color-primary);
  --button-text-color: var(--theme-1-text-light);
	--button-hover-background-color: var(--theme-1-color-primary-tone);
  --button-hover-text-color: var(--theme-1-text-light);
  --button-hover-border-color: var(--theme-1-color-primary-tone);
	--button-font-family: var(--theme-1-font-family-primary);
  --button-padding: 1.5rem;
	--button-letter-spacing: 1px;
	--button-transition: all 0.1 ease-out;
}

/**
 * Theme 2 Button styles
 */
.theme-2 {
	--button-background-color: var(--theme-2-color-white);
	--button-hover-background-color: var(--theme-2-color-brand-green);
	--button-text-color: var(--theme-2-color-gray-50);
	--button-hover-text-color: var(--theme-2-color-white);
	--button-border-color: var(--theme-2-color-gray-10);
  --button-font-family: var(--theme-2-font-family-primary);
	--button-font-size: 13px;
	--button-text-transform: capitalize;
	--button-padding: 15px 3rem;
}

/**
 * Theme 3
 * 1) Note: I'm not creating design tokens for each theme. Hopefully
 *    two themes (theme 1 and theme 2) are enough to demonstrate 
 *    the concept.
 */
.theme-3 {
	--button-background-color: #0892D0;
	--button-hover-background-color: #0892D0;
	--button-text-color: #fff;
	--button-hover-text-color: #fff;
	--button-border-color: #ed1c24;
	--button-border-width: 0;
  --button-border-radius: 30px 0 30px 0;
  --button-box-shadow: 6px 6px 0 yellow;
	--button-font-family: 'Crete Round', serif;
	--button-font-size: 18px;
	--button-font-weight: 300;
	--button-letter-spacing: 2px;
	--button-padding: 1rem 2rem;
	--button-text-transform: normal;
}

/**
 * Theme 4
 */
.theme-4 {
	--button-background-color: #f9f9f9;
	--button-hover-background-color: #f9f9f9;
	--button-border-color: #999;
	--button-font-family: 'Saira Condensed', sans-serif;
	--button-font-size: 11px;
	--button-font-weight: 500;
	--button-padding: 20px 32px;
	--button-text-color: #333;
	--button-hover-text-color: #a60505;
	--button-text-transform: uppercase;
	--button-letter-spacing: 1.65px;
	--button-icon-width: 0.7rem;
	--button-icon-height: 0.7rem;
	--button-icon-color: #a60505;
}

/**
 * Theme 5
 */
.theme-5 {
	--button-background-color: transparent;
	--button-font-family: 'Amatic SC', cursive;
	--button-font-size: 20px;
	--button-text-color: blue;
	--button-hover-text-color: #252525;
	--button-text-transform: uppercase;
  --button-box-shadow: inset 0 -5px 0 0 rgba(254, 148, 54, 0.7);
  --button-padding: 0 0 10px;
  --button-border-width: 0;
	--button-letter-spacing: 0.8px;
	--button-font-weight: 400;
	--button-icon-color: #fe9436;
}

/**
 * Button styles
 * 1) These are the actual CSS properties for the button component.
 *    The shared CSS declarations as written as normal CSS, but themeable
 *    values are expressed as variables. 
 * 2) A button be marked up as a <button> or <a>
 */
.c-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
  cursor: pointer;
  line-height: 1;
  text-decoration: none;
  font-family: var(--button-font-family);
	font-size: var(--button-font-size);
	font-weight: var(--button-font-weight);
	border-width: var(--button-border-width);
	border-style: var(--button-border-style);
	border-color: var(--button-border-color);
	border-radius: var(--button-border-radius);
	background-color: var(--button-background-color);
	color: var(--button-text-color);
  box-shadow: var(--button-box-shadow);
	padding: var(--button-padding);
	text-transform: var(--button-text-transform);
	letter-spacing: var(--button-letter-spacing);
	transition: var(--button-transition);
}

/**
 * Hover & Focus state for buttons 
 */
.c-btn:hover, .c-btn:focus {
  background: var(--button-hover-background-color);
	color: var(--button-hover-text-color);
  border-color:  var(--button-hover-border-color);
}

/**
 * Block button variation
 * 1) Spans the full width of the container 
 */
.c-btn--block {
	display: block;
	width: 100%;
}

/**
 * Large button variation 
 * 1) Make the button bigger! These values would likely have
 *    variables applied to them in order for individual themes
 *    to control the size of the large button.
 */
.c-btn--large {
	font-size: 1.6rem;
	padding: 1.4rem 2rem;
}

/**
 * Small button variation 
 */
.c-btn--small {
	font-size: 0.8rem;
	padding: 0.5rem 1rem;
}

/*
 * Button icon
 * 1) SVG icon that lives inside a button
 * 2) Can either be before or after button text
 */
.c-btn__icon {
  display: block;
	width: var(--button-icon-width);
	height: var(--button-icon-height);
	fill: var(--button-icon-color);

	.c-btn:hover &,
	.c-btn:focus & {
		background: var(--button-icon-hover-background-color);
	}
}

/**
 * Button icon that appears after button text 
 * 1) Create space between button text and icon
 */
.c-btn__text + .c-btn__icon {
  margin-left: 0.3rem; /* 1 */
}

/**
 * Button text that appears after button icon 
 * 1) Create space between button text and icon
 */
.c-btn__icon + .c-btn__text  {
  margin-left: 0.3rem; /* 1 */
}















/*------------------------------------*\
    #OTHER STUFF
\*------------------------------------*/

ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

li {
  margin-bottom: 2rem;
  margin-right: 2rem
}

.theme-switcher {
	position: fixed;
	top: 0;
	right: 0;
	z-index: 2;
	width: 200px;
  height: 44px;
  font-size: 20px;
}

body {
  padding: 2rem;
}
              
            
!

JS

              
                var themeSwitcher = document.querySelector('.theme-switcher');

themeSwitcher.addEventListener('change',function(){
    var themeName = this.value;
    console.log('name: '+themeName);
    document.body.className = "";
    document.body.classList.add(themeName);
});
              
            
!
999px

Console