WordPress Hosting
Free Photos
WordPress Themes

CSS Style Checkbox with Animation

HTML
<div> <input type="checkbox" id="option"/> <label for="option">Click me <svg viewBox="0 0 60 40" xmlns="http://www.w3.org/2000/svg"><path d="M21,2 C13.4580219,4.16027394 1.62349378,18.3117469 3,19 C9.03653312,22.0182666 25.2482171,10.3758914 30,8 C32.9363621,6.53181896 41.321398,1.67860195 39,4 C36.1186011,6.8813989 3.11316157,27.1131616 5,29 C10.3223659,34.3223659 30.6434647,19.7426141 35,18 C41.2281047,15.5087581 46.3445303,13.6554697 46,14 C42.8258073,17.1741927 36.9154967,19.650702 33,22 C30.3136243,23.6118254 17,31.162498 17,34 C17,40.4724865 54,12.4064021 54,17 C54,23.7416728 34,27.2286213 34,37" id="Path-1" stroke-width="4" fill="none" stroke="#FFF3B0" stroke-dasharray="270" stroke-dashoffset="270"></path></svg> </label> </div>
CSS
@import url(http://fonts.googleapis.com/css?family=Pacifico); body { background-color: #335C67; } svg { width: 1em; height: 1em; position: absolute; left: -.5em; top: .1em; border: 3px solid #fff; } label { display: inline-block; padding-left: 1em; position: relative; cursor: pointer; } input[type="checkbox"] { opacity: 0; width: 50px; height: 100px; } label svg path { transition: stroke-dashoffset .4s linear; } input[type="checkbox"]:checked ~ label svg path { stroke-dashoffset: 0; } input[type="checkbox"]:checked ~ label { color: #FFF3B0; text-decoration: line-through; } div { font-size: 6em; margin: 2em auto; width: 6em; color: #fff; font-family: Pacifico; }
JAVASCRIPT
Expand for more options Login