DEV Community

Loraine Vilches
Loraine Vilches

Posted on

Simple checkbox switch

If you want your switch to work, you need to transform it into a checkbox element, otherwise, you will not be able to know if it is "on" or "off".

So, there's a simple way to do it. Create an box around it and hide the checkbox, and, with a little "css-animation", done.

Here, you will only need to:

  • Put it inside a div and position then in your layout
  • Change the background-color(s)

Top comments (0)