Pen Settings



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


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


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.


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.


                <label class="wraper" for="something">
  <span class="label-text">Some setting</span>
  <div class="switch-wrap">
    <input type="checkbox" id="something" />
    <div class="switch"></div>



                //HOW THIS WORKS:
//The 0fr column takes up no space (yet).
//The two 1fr columns are the toggle nub(??), and the ~visible~ empty space.
//When checked, the left column becomes 1fr and the right column becomes 0fr, creating the effect of the nub moving.


//Change width or padding values freely :)
//But for the 'nub' to look perfectly circular (at 1fr, i.e. 50%), the toggle's height must be half its width, plus the padding value
$width: 120px;
$padding: 7px;
$height: $width / 2 + $padding;

//boring layout stuff:
html { box-sizing: border-box; height: 100% } *, *::before, *::after { box-sizing: inherit; }
body {display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #f5f5f5; }

.wraper {
  display: grid;
  grid-template-columns: auto auto;
  gap: 2em;
  align-items: center;

.label-text {
  font-weight: bolder;
  font-size: 2rem;

//toggle code begins!
.switch-wrap {
  cursor: pointer;
  background: #15273b;
  padding: $padding;
  width: $width;
  height: $height;
  border-radius: $height / 2;
  input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
.switch {
  height: 100%;
  display: grid;
  grid-template-columns: 0fr 1fr 1fr;
  transition: .2s;
  //ICYMI, pseudo elements are treated as grid items
  &::after {
    content: '';
    border-radius: 50%;
    background: #ccc;
    grid-column: 2;
    transition: background .2s;
input:checked {
  + .switch {
    grid-template-columns: 1fr 1fr 0fr; 
    &::after {
      background-color: #52cf71;