0Pricing
CSS Academy · Lesson

:checked :disabled and Form State Pseudos

Style form elements based on their interactive states like checked, disabled, and required.

Form State Pseudo-classes Overview

CSS provides pseudo-classes that reflect HTML form element states. These enable pure-CSS styled form controls without JavaScript.

:checked

:checked applies to checkboxes and radio buttons when they are selected, and to <option> elements within selects when chosen.

input[type="checkbox"]:checked + label {
  color: royalblue;
  font-weight: bold;
}

All lessons in this course

  1. :hover :focus :active and :visited
  2. :nth-child and :nth-of-type
  3. :not() :is() and :where()
  4. :checked :disabled and Form State Pseudos
← Back to CSS Academy