129 of 313 menu

The indeterminate pseudo-class

The indeterminate pseudo-class defines a style of switches that are in an indeterminate state, i.e. not checked.

Syntax

selector:indeterminate { }

Example

Let's recolor the text font green when the checkbox is in an indeterminate state:

<form> <p> <input type="checkbox"> <span>Text</span> </p> </form> input:indeterminate, input:indeterminate + span { color: green; } input, span { color: black; } document.getElementsByTagName('input')[0].indeterminate = true;

:

See also

  • the :default pseudo-class
    that sets a default style for elements
  • the :optional pseudo-class
    that sets a style for the input that does not have a required attribute
  • the :placeholder-shown pseudo-class
    that sets a style for elements when displaying tooltip text
  • the :read-only pseudo-class
    that sets a style for inputs that cannot be changed
  • the :required pseudo-class
    that sets a style of the input that has the required attribute set
  • the :focus-within pseudo-class
    that styles the elements in focus
  • the caret-color property
    that sets a color of the text cursor in input
byenru