Today, I had to create a custom solution for a design requirement. A custom checkbox! It was fun doing it of course and I learned bit more about CSS.
However, I realized that it took me more time to track down the perfect custom solution that was need for me than the complexity of the solution itself. I did not want anything that will make my style sheets more messier and also not for just fancy. Just the right one needed as per the design.
Here follows the code piece. I am trying out this new approach where I add comments in order to explain what a piece of code does or why does it need to be there. ^_^
1 | <div> |
Here comes the fun part of CSS only!
1 | /* First hide the default browser's boring style. */ |
Tip: As you can see, I just used the general style property. This works fine in chrome. I strongly advice to use CSS preprocessors like
SASSso that you do not need to worry about browser specific property prefixes such as-webkit-for chrome. \O/
https://custom-checkbox-css-only.netlify.com/
Sneak Peek
