css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              
<div class="ex1">
  <h2>Standard Styling</h2>
  <label>
    <input type="checkbox">
    Wrapped in label
  </label>

  <hr>

  <input type="checkbox" id="d">
  <label for="d">
    Separate Elements
  </label>
 
</div>

<div class="ex2">
  <h2>Custom styling</h2>
  <p>
    Note that much of the custom styling of the checkboxes will not be reflected in IE11 or Edge. These browsers have alternate custom styles.
  </p>
  
  <label>
    <input type="checkbox">
    Wrapped in label, custom style
  </label>

  <hr>

  <input type="checkbox" id="b">
  <label for="b">
    Separate Elements, custom style
  </label>
  
  
</div>
            
          
!
            
              /**
note the following ex1 styles are not respected by checkboxes
in all browsers. 
*/

.ex1 input {
  background: #f00;
  border: 4px solid blue;
  padding: 10px;
}

/**
resetting the appearance allows for more specific styles to be
applied to checkboxes, but IE11 doesn't respect the vendor
prefixed properties, so these styles won't be respected there.
*/

.ex2 input {
  -moz-appearance: none;
  -o-apperance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 1px solid;
  border-radius: 4px;
  height: 2em;
  width: 2em;
  font-size: inherit;
  line-height: 1;
  vertical-align: bottom;
  position: relative;
  
  &:before,
  &:after {
    content: "";
    position: absolute;
    transition: transform .2s ease-in-out;
  }
  
  &::-ms-check {
   border: 2px solid #888;
   border-radius: 2px;
   color: green;
  }
  
  &:before,
  &:after {
    border-right: 3px solid green;
    border-bottom: 3px solid green;
    width: .625em;
    height: 1em;
    transform: rotate(45deg) scale(0);
    right: .5em;
    top: -.5em;
    bottom: 0;
    margin: auto;
  }
  
  &:checked {
    box-shadow: inset 0 0 20px 3px rgba(green, .05)
  }
  
  &:checked:before {
    transform: rotate(45deg) scale(1);
  }
  
  &:checked:after {
    animation: expand .8s;
  }
   
  &:focus {
    box-shadow: 0 0 0 1px;
    border: 2px solid;
    outline: none;
    /*
      can use outline none here because revised box-shadow
      and border-width adjustments are made to replace
      the default outline indicator.
    */
  }
}
    

@keyframes expand {
  0% {
    transform: rotate(45deg) scale(0);
    opacity: 1;
  }
  50% {
    top: -30px;
    transform: rotate(45deg) scale(2.25);
    opacity: 1;
  }
  100% {
    opacity: 0;
    top: -30px;
    transform: rotate(45deg) scale(2.25);
  }
}



.ex1, .ex2 {
  max-width: 30em;
  margin: auto;
}

 .ex2 {
  margin-top: 2em;
 }


body {
  font-family: arial;
}
            
          
!
            
              /**
  A completely native checkbox element where the accessible name of the input is provided by the text of the <label> element. Since the input is a child of the <label> a for attribute, on the label element, pointing to the ID of the input is not necessary.
  
  Note, Safari 12 + VoiceOver presently has a but (Nov 2018), where VoiceOver will announce the accessible name "my option" twice. 
  
  This bug is unique to this screen reader and browser pairing.
*/
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console