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

              
                <h2>CSS Technique: Style Checkboxes And Radio Buttons Technique 1 Toggle Background Color Checkbox/Radio Button</h2>
<p>
 <label><input type="checkbox" name="unique to indicate checkbox1, if checked, when form submitted" /><span></span> Checkbox</label><br />
 <label><input type="checkbox" name="unique to indicate checkbox2, if checked, when form submitted" checked="checked" /><span></span> Checkbox default checked/pre-checked</label><br />
 <label><input type="checkbox" name="unique to indicate checkbox3, if checked, when form submitted" />Checkbox <span></span></label>
</p>
<p>
 <label><input type="radio" name="creates radio button group and indicates radio button group1 when form submitted" value="unique to indicate value1, if checked, when form submitted" /><span></span> Radio button</label><br />
 <label><input type="radio" name="creates radio button group and indicates radio button group1 when form submitted" value="unique to indicate value2, if checked, when form submitted" checked="checked" /><span></span> Radio button default checked/pre-checked</label><br />
 <label><input type="radio" name="creates radio button group and indicates radio button group1 when form submitted" value="unique to indicate value3, if checked, when form submitted" />Radio button <span></span></label>
</p>
<p>Web browser support: IE9+, ED12+, FF4+, SF5+, CH13+, OP11.60+.</p>
<p>For an explanation of the code, see http://www.learnwebcoding.com/css/css_techniques/style_checkboxes_radio_buttons.php.</p>
              
            
!

CSS

              
                body {
  line-height: 1.5;
}
input[type="checkbox"], input[type="radio"] {
  display: none;
}
label input[type="checkbox"] ~ span, label input[type="radio"] ~ span {
  display: inline-block;
  width: 12px;
  height: 12px;
  vertical-align: top;
  border: 2px solid #999;
  box-sizing: content-box;
  -moz-box-sizing: content-box;
  margin-top: 3px;
}
label input[type="checkbox"] ~ span {
  border-radius: 2px;
}
label input[type="radio"] ~ span {
  border-radius: 12px;
}
label input[type="checkbox"]:checked ~ span, label input[type="radio"]:checked ~ span {
  background-color: #000;
}
label:hover input[type="checkbox"] ~ span, label:hover input[type="radio"] ~ span {
  border-color: #666;
}
              
            
!

JS

              
                
              
            
!
999px

Console