Material Inspired Checkboxes

See the Pen Material Inspired Checkboxes by BuddyLReno (@BuddyLReno) on CodePen.

Material Inspired Checkboxes

Description: The trick to this is placing the label after the checkbox. That way you can use the :checked state to toggle the different pseudo elements on the label. No javascript necessary. To make the background animation work, you'll need a tiny bit of magic. The label:before element is a small 10x10 circle. We animate the scale of it instead of the size so that we can keep the proportion of the circle and make it look like it "fills out" the bar. The max width of the form is set to 550px. The :before element animates by using scale3d (for hardware acceleration) by 56 times. 56 * 10 === 560. This allows the circle to fill out the bar by going slightly outside the bounds of the input group container.

Made with: HTML

Posted: 12.09.2017

Similar Examples