Pen Settings

HTML

CSS

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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

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.

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

              
                <div class="wrapper">
    <h1>Animated CSS checkboxes and radiobuttons </h1>
    <h4>With fallback for browser with no support to animate dash-offset and dash-array properties</h4>
    <br>
    
    <div class="input-wrapper">
        <input class="fancy-check" hidden id="check1" type="checkbox"></input>
        <label class="fancy-check-label" for="check1">
            <span class="fancy-label--text">Aliquam tincidunt mauris eu risus</span>
            <span class="fancy-checkbox">
                 <svg class="checkmark" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
                    <path class="checkmark-path" fill="none" d="M4 10 l5 4 8-8.5"/>
                </svg>
            </span>
        </label>
    </div>
    <div class="input-wrapper">
        <input class="fancy-check" hidden id="check2" checked type="checkbox"></input>
        <label class="fancy-check-label" for="check2">
            <span class="fancy-label--text">Vestibulum auctor dapibus neque</span>
            <span class="fancy-checkbox">
                 <svg class="checkmark" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
                    <path class="checkmark-path" fill="none" d="M4 10 l5 4 8-8.5"/>
                </svg>
            </span>
        </label>
    </div>
    <div class="input-wrapper">
        <input class="fancy-check" hidden id="check3" type="checkbox"></input>
        <label class="fancy-check-label" for="check3">
            <span class="fancy-label--text">Cras ornare tristique elit</span>
            <span class="fancy-checkbox">
                 <svg class="checkmark" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
                    <path class="checkmark-path" fill="none" d="M4 10 l5 4 8-8.5"/>
                </svg>
            </span>
        </label>
    </div>
    <br>
    <div class="input-wrapper">
        <input class="fancy-radio" hidden id="radio1" name="radio-group" type="radio"></input>
        <label class="fancy-radio-label" for="radio1">
            <span class="fancy-label--text">Aliquam tincidunt mauris eu risus</span>
            <span class="fancy-radiobutton">
                <span class="radiobutton-dot"></span>
            </span>
        </label>
    </div>
    <div class="input-wrapper">
        <input class="fancy-radio" hidden id="radio2" checked name="radio-group" type="radio"></input>
        <label class="fancy-radio-label" for="radio2">
            <span class="fancy-label--text">Praesent placerat risus quis eros</span>
            <span class="fancy-radiobutton">
                <span class="radiobutton-dot"></span>
            </span>
        </label>
    </div>
    <div class="input-wrapper">
        <input class="fancy-radio" hidden id="radio3" name="radio-group" type="radio"></input>
        <label class="fancy-radio-label" for="radio3">
            <span class="fancy-label--text">Cras ornare tristique elit</span>
            <span class="fancy-radiobutton">
                <span class="radiobutton-dot"></span>
            </span>
        </label>
    </div>
</div>	
              
            
!

CSS

              
                @keyframes checkmarkAnimation {
	 100% {
		 stroke-dashoffset: 0;
	}
}
 body {
	 color: #888;
}
 .wrapper {
	 font-size: 18px;
	 margin: 0 auto;
	 max-width: 800px;
	 padding: 0 20px;
}
 .input-wrapper {
	 margin: 20px 0;
	 position: relative;
}
 .fancy-check-label, .fancy-radio-label {
	 display: inline-block;
	 line-height: 24px;
	 padding-left: 36px;
	 position: relative;
	 user-select: no-select;
}
 .crappy-browser .fancy-check-label .checkmark-path {
	 opacity: 0;
}
 .modern-browser .fancy-check-label {
	 transition: color 0.3s;
}
 .fancy-check:checked + .fancy-check-label {
	 color: darkorange;
}
 .fancy-check:checked + .fancy-check-label .fancy-checkbox {
	 border-color: darkorange;
}
 .modern-browser .fancy-check:checked + .fancy-check-label .checkmark-path {
	 animation: checkmarkAnimation 0.5s 0s forwards;
}
 .crappy-browser .fancy-check:checked + .fancy-check-label .checkmark-path {
	 opacity: 1;
	 stroke-dasharray: 0;
	 stroke-dashoffset: 0;
}
 .fancy-label--text {
	 position: relative;
}
 .fancy-radio:checked + .fancy-radio-label {
	 color: darkorange;
}
 .fancy-radio:checked + .fancy-radio-label .fancy-label--text::before {
	 transition: transform 0.15s;
	 transform: scaleX(1);
}
 .fancy-radio:checked + .fancy-radio-label .fancy-radiobutton {
	 border-color: darkorange;
	 transition: border-color 0.5s;
}
 .fancy-radio:checked + .fancy-radio-label .radiobutton-dot {
	 opacity: 1;
	 transform: translate(-50%, -50%) scale(1);
	 transition: opacity 0.15s, transform 0.15s;
}
 .fancy-checkbox, .fancy-radiobutton {
	 border: solid 2px #888;
	 display: block;
	 height: 20px;
	 position: absolute;
	 left: 0;
	 top: 0;
	 width: 20px;
}
 .modern-browser .fancy-checkbox, .modern-browser .fancy-radiobutton {
	 transition: border-color 0.3s;
}
 .fancy-checkbox {
	 border-radius: 3px;
}
 .fancy-radiobutton {
	 border-radius: 50%;
}
 .radiobutton-dot {
	 background-color: currentColor;
	 border-radius: 50%;
	 height: 12px;
	 opacity: 0;
	 position: absolute;
	 left: 50%;
	 top: 50%;
	 transform: translate(-50%, -50%) scale(0);
	 width: 12px;
}
 .checkmark {
	 height: 20px;
	 opacity: 1;
	 width: 100%;
}
 .checkmark .checkmark-path {
	 stroke: darkorange;
	 stroke-width: 2px;
	 transform-origin: 50% 50%;
	 stroke-miterlimit: 10;
	 opacity: 1;
	 stroke-dasharray: 48;
	 stroke-dashoffset: 48;
}
              
            
!

JS

              
                // Javascript for detecting browsers who do not support this, and provide fallback
if (window.navigator.userAgent.indexOf("Edge") !== -1 || navigator.appVersion.indexOf("MSIE 10") !== -1 || window.navigator.userAgent.indexOf("Trident/7.0") > 0) { 
    document.documentElement.className += ' crappy-browser';
} else {
    document.documentElement.className += ' modern-browser';
}
              
            
!
999px

Console