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

              
                <!-- Semantic: Once you find it can be reused. -->
<label class="inline-flex align-items:center">
    <input class="switch-input" type="checkbox" checked/>
    <svg class="switch">
        <rect class="switch-thumb" x="2" y="2" rx="14"/>
    </svg>
</label>

<!-- Lego: Start your build the LEGO way. -->
<label class="inline-flex align-items:center ml:10">
    <input class="
        hide bg:#30d158:checked+svg opacity:.7[disabled]+svg
        filter:none[disabled]+svg>rect 
        width:34:active:not([disabled])+svg>rect 
        cursor:no-drop[disabled]+svg
        translateX(19):checked+svg>rect       
        translateX(13):checked:active:not([disabled])+svg>rect
    " type="checkbox" />
    <svg class="width:51 height:32 bg:fade-90 bg:gray-20@dark rounded ~background-color|.3s cursor:pointer">
        <rect class="~transform|.1s|ease-out,width|.1s|ease-out drop-shadow(0|2|2|rgba(0,0,0,.2))" x="2" y="2" rx="14" width="28" height="28" fill="#fff" />
    </svg>
</label>

<!-- https://styles.master.co/ -->
<p class="abs bottom:0 py:10 font:12 text:center font:fade bg:fade-5 w:full">Powered by
  <a href="https://styles.master.co" class="text:underline" target="blank">
    Master CSS
  </a>
</p>
              
            
!

CSS

              
                /* just for demo */
body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  position: absolute;
  margin: auto;
  left: 0;
  right: 0;
}
              
            
!

JS

              
                MasterStyle.extend('classes', {
  'switch-input': `
      hide bg:#30d158:checked+svg opacity:.7[disabled]+svg
      filter:none[disabled]+svg>rect 
      width:34:active:not([disabled])+svg>rect 
      cursor:no-drop[disabled]+svg
      translateX(19):checked+svg>rect       
      translateX(13):checked:active:not([disabled])+svg>rect
  `,
  'switch': `
      width:51 height:32 bg:fade-90 bg:gray-20@dark rounded ~background-color|.3s cursor:pointer
  `,
  'switch-thumb': `
      ~transform|.1s|ease-out,width|.1s|ease-out drop-shadow(0|2|2|rgba(0,0,0,.2))
      x:2 y:2 rx:14 w:28 h:28 fill:white
  `
})
              
            
!
999px

Console