cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

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

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

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.

            
              <form action="">
    <fieldset class="options">
        <legend>Radio</legend>
        <ul>
            <li><input id="radio1" name="radio" type="radio" class="radio" checked="checked"> <label for="radio1">Option 1</label></li>
            <li><input id="radio2" name="radio" type="radio" class="radio"> <label for="radio2">Option 2</label></li>
            <li><input id="radio3" name="radio" type="radio" class="radio"> <label for="radio3">Option 3</label></li>
        </ul>
    </fieldset>
    <fieldset class="options">
        <legend>Checkbox</legend>
        <ul>
            <li><input id="checkbox1" name="checkbox" type="checkbox" checked="checked"> <label for="checkbox1">Choice A</label></li>
            <li><input id="checkbox2" name="checkbox" type="checkbox"> <label for="checkbox2">Choice B</label></li>
            <li><input id="checkbox3" name="checkbox" type="checkbox"> <label for="checkbox3">Choice C</label></li>
        </ul>
    </fieldset>
  <!--
  <fieldset>
    <legend>Fields</legend>
    <ul>
      <li>
        <label for="">text</label>
        <input type="text" />
        <span class="error-msg">Error</span>
      </li>
      <li>
        <label for="">email</label>
        <input type="email" required />
        <span class="error-msg">Error</span>
      </li>
      <li>
        <label for="">number</label>
        <input type="number" />
        <span class="error-msg">Error</span>
      </li>
      <li>
        <label for="">password</label>
        <input type="password" placeholder="your password" />
        <span class="error-msg">Error</span>
      </li>
    </ul>
  </fieldset>
-->
  <fieldset>
    <legend>Select</legend>
      <ul>
        <li>
          <select>
            <optgroup label="Option Group 1">
              <option>Option 1</option>
              <option>Option 2</option>
            </optgroup>
            <optgroup>
              <option>Option 3</option>
            </optgroup>
          </select>
      </li>
    </ul>
  </fieldset>
</form>
            
          
!
            
              
// custom inputs
// custom checkbox/radios
$fw-input-padding:            6px                      !default;
$fw-check-height:             24px                     !default;
$fw-check-width:              $fw-check-height         !default;
$fw-check-scale:              6px                      !default; // optimized for even numbers
$fw-check-input-bg-color:     #fff                     !default;
$fw-check-border-width:       1px                      !default;
$fw-check-border-radius:      null                     !default;
$fw-check-border-color:       #444                     !default;
$fw-check-focus-color:        #333                     !default;
$fw-check-focus-bg-color:     $fw-check-input-bg-color !default;
$fw-check-focus-border-color: #000 !default;

// visually hide elements the accessible way
@mixin vh {
	border: 0                      !important;
	clip: rect(1px, 1px, 1px, 1px) !important;
	clip-path: inset(50%)          !important;
	height: 1px                    !important;
	overflow: hidden               !important;
	padding: 0                     !important;
	position: absolute             !important;
	width: 1px                     !important;
	white-space: nowrap            !important;
}

[type="checkbox"],
[type="radio"] {
  @include vh();

  &:focus {

    + label {

      &::before {
        box-shadow: 0 0 0 2px rgba($fw-check-focus-color, 0.4) !important;
      }
    }
  }

  &:hover {

    + label {

      &::before {
        border-color: $fw-check-focus-border-color;
      }
    }
  }

  &:active {

    + label {

      &::before {
        transition-duration: 0;
      }
    }
  }

  + label {
    position: relative;
    padding: $fw-input-padding;
    user-select: none;

    &::before {
      background-color: $fw-check-input-bg-color;
      border: $fw-check-border-width solid $fw-check-border-color;
      box-sizing: content-box;
      content: '';
      color: $fw-check-border-color;
      margin-right: $fw-check-width * 0.25;
      top: 50%;
      left: 0;
      width: $fw-check-width;
      height: $fw-check-height;
      display: inline-block;
      vertical-align: middle;
    }

    &::after {
      box-sizing: content-box;
      content: '';
      background-color: $fw-check-border-color;
      position: absolute;
      top: 50%;
      left: $fw-input-padding + $fw-check-border-width + $fw-check-scale/2;
      width: $fw-check-width - $fw-check-scale;
      height: $fw-check-height - $fw-check-scale;
      margin-top: ($fw-check-height - $fw-check-scale)/-2;
      transform: scale(0);
      transform-origin: 50%;
      transition: transform 200ms ease-out;
    }
  }

  &[disabled] {

    + label {

      &::before {
        animation: none;
        box-shadow: none;
        border: 1px solid rgba(128, 128, 128, 0.5);
      }
    }

    &:active,
    &:focus,
    &:hover {

      + label {

        &::before {
          border-color: rgba(128, 128, 128, 0.5);
          filter: none;
          transition: none;
        }
      }
    }
  }
}

[type="checkbox"] {

  + label {

    &::before,
    &::after {
      @if ($fw-check-border-radius) {
        border-radius: $fw-check-border-radius;
      }
      @else {
        border-radius: 0;
      }
    }

    &::after {
      background-color: transparent;
      top: 50%;
      left: calc(#{$fw-input-padding} + #{$fw-check-border-width} + #{$fw-check-width}/5);
      width: $fw-check-width/2;
      height: $fw-check-width/5;
      margin-top: calc(#{$fw-check-height} / -2 / 2 * 0.8);
      border-style: solid;
      border-color: $fw-check-border-color;
      border-width: 0 0 3px 3px;
      border-radius: 0;
      border-image: none;
      transform: rotate(-45deg) scale(0);
      transition: none;
    }
  }

  &:checked {

    + label {

      &::after {
        content: ''; //\2713';
        transform: rotate(-45deg) scale(1);
        transition: transform 200ms ease-out;
      }
    }
  }
}

[type="radio"] {

  + label {

    &::before,
    &::after {
      @if ($fw-check-border-radius) {
        border-radius: $fw-check-border-radius;
      }
      @else {
        border-radius: 50%;
      }
    }
  }

  &:checked {

    &:active,
    &:focus {

      + label {

        &::before {
          animation: none;
          filter: none;
          transition: none;
        }
      }
    }

    + label {

      &::before {
        animation: none;
        background-color: $fw-check-input-bg-color;
      }

      &::after {
        transform: scale(1);
      }
    }
  }
}



@keyframes borderscale {
  50% {
    box-shadow: 0 0 0 2px #900;
  }
}




// select
select {
  appearance: none;
  background-color: #fff;
  background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2216%22%20height%3D%228%22%20viewBox%3D%220%200%2016%208%22%3E%3Cpolygon%20fill%3D%22%234D4D4D%22%20points%3D%228%2C0%2016%2C0%2012%2C4%208%2C8%204%2C4%200%2C0%20%22/%3E%3C/svg%3E);
  background-repeat: no-repeat;
  background-position: 95% 50%;
  border: $fw-check-border-width solid grey;
  border-radius: 0;
  padding: 0.25em 0.4em;
  padding-right: 1.5em;

  &:focus,
  &:hover {
    border-color: black;
    outline: none;
  }

  &:active {
    border-color: #900;
  }

 // Fix Firefox dotted focusring
 &:-moz-focusring {
    color: transparent;
    text-shadow: 0 0 0 #000;
  }
}

 /* IE 10/11+ - This hides native dropdown button arrow so it will have the custom appearance, IE 9 and earlier get a native select - targeting media query hack via http://browserhacks.com/#hack-28f493d247a12ab654f6c3637f6978d5 - looking for better ways to achieve this targeting */
/* The second rule removes the odd blue bg color behind the text in the select button in IE 10/11 and sets the text color to match the focus style's - fix via http://stackoverflow.com/questions/17553300/change-ie-background-color-on-unopened-focused-select-box */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
	select::-ms-expand {
		display: none;
	}
	select:focus::-ms-value {
		background: transparent;
		color: grey;
	}
}









// errors

.error-msg {
  display: block;
  color: red;
  max-height: 0;
  overflow: hidden;
  
  transition: max-height 500ms ease-out;
  will-change: max-height;
}



// WIP
:required:not(:focus) ~ .error-msg,
:invalid:required ~ .error-msg {
  max-height: 9em;
}

input:focus {
  border: 1px solid black;  
}

input:not(:focus):invalid {
  border: 1px solid red;
  outline: none;
}

input:not(:focus):valid {
  border: 1px solid green;
}





// global
* {
	box-sizing: border-box;
}

body {
  padding: 1em;
}

form ul {
  list-style: none;
}

label {
	cursor: pointer;
  display: inline-block;
}

            
          
!
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