Take the pain out of building site search with the Algolia hosted API. Start free now!
:disabled pseudo-class selector provides conditional styling to HTML elements that can receive user input, when the elements have the
disabled attribute. It is defined in the CSS Selectors Level 3 spec as a “UI element state pseudo-class”, meaning it is used to style content based on the user’s interaction with an input element.
Elements that can receive the
disabled attribute include
<fieldset>. There are two valid syntaxes for setting this attribute: either
disabled="disabled" or (in HTML5) simply the
disabled Boolean keyword. An element is disabled if it can’t be activated (e.g. selected, clicked on or accept text input) or accept focus.
Such an element can be styled using the
:disabled pseudo-class selector:
Points of Interest
:disabledcan be “chained” with other pseudo-selectors: like
:afterto generate icons or text to provide more user feedback.
- Any property that can be animated with CSS Transitions or Animations will be properly animated when the
disabledattribute is added or removed from the HTML element.