Author: | msisto |
---|---|
Views Total: | 17,641 views |
Official Page: | Go to website |
Last Update: | September 1, 2014 |
License: | MIT |
Preview:

Description:
Helps you create nice checkboxes and radio buttons with Google material design inspired ripple/wave effects. Built only with CSS/CSS3. Created by msisto.
How to use it:
Add a group of checkboxes and radio buttons into your document.
<label> <input type="checkbox" class="option-input checkbox" checked> Checkbox 1 </label> <label> <input type="checkbox" class="option-input checkbox"> Checkbox 2 </label> <label> <input type="checkbox" class="option-input checkbox"> Checkbox 3 </label> <label> <input type="radio" class="option-input radio" name="example" /> Radio option 1 </label> <label> <input type="radio" class="option-input radio" name="example" /> Radio option 2 </label> <label> <input type="radio" class="option-input radio" name="example" /> Radio option 3 </label>
The CSS to restyle the checkboxes and radio buttons.
.option-input { -webkit-appearance: none; -moz-appearance: none; -ms-appearance: none; -o-appearance: none; appearance: none; position: relative; top: 13.33333px; width: 40px; height: 40px; -webkit-transition: all 0.15s ease-out 0; -moz-transition: all 0.15s ease-out 0; transition: all 0.15s ease-out 0; background: #cbd1d8; border: none; color: #fff; cursor: pointer; display: inline-block; outline: none; position: relative; margin-right: 0.5rem; z-index: 1000; } .option-input:hover { background: #9faab7; } .option-input:checked { background: #40e0d0; } .option-input:checked::before { width: 40px; height: 40px; position: absolute; content: '\2716'; display: inline-block; font-size: 26.66667px; text-align: center; line-height: 40px; } .option-input:checked::after { -webkit-animation: click-wave 0.65s; -moz-animation: click-wave 0.65s; animation: click-wave 0.65s; background: #40e0d0; content: ''; display: block; position: relative; z-index: 100; } .option-input.radio { border-radius: 50%; } .option-input.radio::after { border-radius: 50%; }
The CSS3 rules to create Material Design styled ripple/wave effects using keyframes.
@-webkit-keyframes click-wave { 0% { width: 40px; height: 40px; opacity: 0.35; position: relative; } 100% { width: 200px; height: 200px; margin-left: -80px; margin-top: -80px; opacity: 0.0; } } @-moz-keyframes click-wave { 0% { width: 40px; height: 40px; opacity: 0.35; position: relative; } 100% { width: 200px; height: 200px; margin-left: -80px; margin-top: -80px; opacity: 0.0; } } @-o-keyframes click-wave { 0% { width: 40px; height: 40px; opacity: 0.35; position: relative; } 100% { width: 200px; height: 200px; margin-left: -80px; margin-top: -80px; opacity: 0.0; } } @keyframes click-wave { 0% { width: 40px; height: 40px; opacity: 0.35; position: relative; } 100% { width: 200px; height: 200px; margin-left: -80px; margin-top: -80px; opacity: 0.0; } }
Doesn’t work on Firefox.
Anyone know a workaround for Firefox? The issue, apparently, is non-recognition of pseudo elements (:before, :after) on input elements.