Create Custom Checkbox CSS Styles with SVG

Share this video with your friends

Send Tweet

This lesson will focus on creating the checkbox styles for both the default and checked state. We'll make sure our styles are accessible and able to use our theme system.

We'll get started by adding an inline SVG to our input which we can style. I'll give you a tour of what is happening with the SVG and show you how to display it in the checkbox by providing a width. From there we will set the default state of the SVG to a scale(0) and set up a transition so when the checkbox is clicked to scale the SVG to 1.

Ashley-King
Ashley-King
~ 2 years ago

Seeing some weirdness in chrome with the checkmark svg. In case anyone else runs into this, I changed d="M1.73 12.91l6.37 6.37l22.79 4.59" to d="M1.73 12.91l6.37 6.37L22.79 4.59"

(capitalized the "L" in 6.37L22.79)

and that fixed the issue.