4

I have a feature that enables tristate check boxes.

Following is the snapshot of the check boxes that appear in Chrome:

enter image description here

The third checkbox in the snapshot above has indeterminate state. This state has browser specific CSS.

I need to change the CSS of third checkbox to look something like: enter image description here

I am fairly new to CSS. Any help would be appreciated.

Thanks in advance.

varunvlalan
  • 940
  • 10
  • 23

1 Answers1

4

This is the :indeterminate selector..

https://developer.mozilla.org/en-US/docs/Web/CSS/:indeterminate

tag.class:indeterminate {}

In this case you can change the background: attribute to the image you like.

Something along the lines of:

tag.class:indeterminate {
    background: url("/image");
}

I recommend you look into this handling of :checked for styling your checkboxes:

EDIT: Or as @FelixLahmer added, use: http://www.csscheckbox.com/css-checkbox-generator.php

Community
  • 1
  • 1
digitalextremist
  • 5,952
  • 3
  • 43
  • 62