The default pseudo-class

The default pseudo-class specifies a style of one element from a group that has a default type. These elements must be inside the parent <form> tag.

Syntax

cssselector:default {
  
}

Example

An example of a default type is the type attribute with the submit value. Let's set one of these buttons to have a blue background:

html<form>
  <p>
    <label>Enter number</label>
    <input type="number">
  </p>
  <p>
    <input type="submit">
    <input type="submit">
    <input type="reset">
  </p>
</form>
css:default {
  background-color:  #C2DDFD;
}

Результат:

See also

  • the :fullscreen pseudo-class
    that styles elements in full screen mode
  • the :in-range pseudo-class
    that sets a style to elements with a given range of values
  • the :invalid pseudo-class
    that sets a style for the input into which an invalid value was entered
  • the :optional pseudo-class
    that sets a style for the input that does not have a required attribute
  • the :out-of-range pseudo-class
    that styles elements whose values ​​are out of range
  • the :focus-within pseudo-class
    that styles the elements in focus