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.

    input.styled-checkbox#1(type="checkbox" value="value1")
       Checkbox Item 1
    input.styled-checkbox#2(type="checkbox" value="value2")
      Checkbox Item 2
    input.styled-checkbox#3(type="checkbox" value="value2")
      Checkbox Item 3
    input.styled-checkbox#4(type="checkbox" value="value2")
      Checkbox Item 4
    input.styled-checkbox#5(type="checkbox" value="value2")
      Checkbox Item 5
    input.styled-checkbox#6(type="checkbox" value="value2")
      Checkbox Item 6
    input.styled-checkbox#7(type="checkbox" value="value2")
      Checkbox Item 7
    input.styled-checkbox#8(type="checkbox" value="value2")
      Checkbox Item 8
    .saved You list has been saved
    input#submit(type="submit" value="save")
              // based on: https://codepen.io/Vestride/pen/dABHx
input[type=submit] {
  background: #27ae60;
  color: #fff;
  cursor: pointer;
  text-transform: uppercase;
  font-weight: bold;
  border: none;
  border-radius: 20px;
  padding: 10px 20px;
  // Not great, but necessary due to the weird float nature of the labels
  position: absolute;
  bottom: 10px;
  left: 30px;
  position: absolute;
  opacity: 0;
  & + label {
    position: relative;
    cursor: pointer;
    padding: 0;
    clear: left;
    float: left;
    margin: 10px 0;
  & + label:before {
    content: '';
    background: url('https://davidholbrook.info/cdn/no-check.svg?v=2') no-repeat;
    margin: 0 10px;
    display: inline-block;
    vertical-align: middle;
    width: 30px;
    height: 30px;
    transition: all 1s linear;
  &:checked + label::before{
    content: '';
    background: url('https://davidholbrook.info/cdn/checked.svg') no-repeat;
    margin:  0 10px 0 5px;
    display: inline-block;
    vertical-align: middle;
    width: 40px;
    height: 40px;
    animation: something 1s ease-in-out;

@keyframes something{
    transform: scale(1);
    transform: scale(2);
    transform: scale(1);

// Demo stuff
  color: #333;
  font-size: 1.2rem;
  padding: 50px;

  background: white;
  padding: 20px;
  padding-bottom: 80px;
  margin-bottom: 50px;
  border-radius: 5px;
  box-shadow:  0 0 10px 5px rgba(black, 0.3);
  overflow: hidden;
  position: relative;
  max-width: 800px;
    margin-top: 0;
    text-align: center;
    text-transform: uppercase;

  background: #27ae60;
  color: #ffffff;
  display: none;
  padding: 10px 20px;
  position: absolute;
  bottom: 10px;
  right: 20px;
  border-radius: 20px
              // =================================
// Retrive the localStorage
// =================================
  if (localStorage.getItem("checked") !== null) {
    let ls = localStorage.getItem("checked").split(',')
    for(let index in ls){
      document.getElementById(ls[index]).checked = true

  // =================================
  // Sets the localStorage
  // =================================

  // set as an array
  let arr = []
  const el = document.querySelectorAll('#checkbox-form input')

  arr = Array.from(el)
  // console.info(arr)

  document.getElementById('submit').addEventListener('click', function(e){

    // loop through array and check if checkbox is checked
    let cc = []
    for (let index in arr) {
     // And stick the checked ones onto an array...
       if (arr[index].checked) {

    // convert array to a string
    let dd = cc.join(',')

    //set the localStorage
    localStorage.setItem("checked", dd)
    //TODO: clear localstorage if nothing is checked

    //let the user know that the item has been saved
    document.querySelector('.saved').style.display = 'block'
      document.querySelector('.saved').style.display = 'none'
🕑 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 ..................