DEV Community

Cover image for Custom checkbox not working
Sara Ounissi
Sara Ounissi

Posted on • Originally published at

Custom checkbox not working

Customizing checkboxes is a little tricky, it requires a lot of additional CSS to make it look nice. One important thing to remember while doing that is to make sure the id you use on the input is the same as the for on the label.

Example :

<p>Choose your favorite fruit:</p>

  <input type="checkbox" id="apple" name="apple"
  <label for="apple">Apple</label>

  <input type="checkbox" id="orange" name="orange">
  <label for="orange">Orange</label>
Enter fullscreen mode Exit fullscreen mode

Top comments (0)