# :disabled

> The `:disabled` CSS pseudo-class applies to form elements that are currently disabled.

## Why doesn't :disabled match my button with aria-disabled?

The pseudo-class that targets form elements that are disabled, preventing user interaction. It's commonly used to style input fields, buttons or other controls that are temporarily or permanently inactive, often graying them out or reducing their opacity.

- Topic: Pseudo Classes
- Type: pseudo-class
- Browser support: Chrome 1+, Chrome Android 18+, Edge 12+, Firefox 1+, Firefox Android 4+, Safari 3.1+, Safari iOS 2+

## Example

Wrong:

```css
button:disabled {
  opacity: 0.5;
}
```

Right:

```css
button:disabled,
button[aria-disabled='true'] {
  opacity: 0.6;
  cursor: not-allowed;
}
```

`aria-disabled` buttons stay focusable but don't match `:disabled`, so they need the attribute selector too.

## Common mistakes

- Styling a `div` as disabled with `:disabled`, which only matches form elements.
- Using `pointer-events: none` as the only disabled state, while keyboard users can still activate it.

## Key points

- Elements with `aria-disabled='true'` are styled with `[aria-disabled='true']`, not `:disabled`.
- Disabled styles keep readable contrast and don't depend only on lower opacity.
- Form controls inside a disabled `<fieldset>` are expected to match `:disabled` too.

## Interview questions

### What is the difference between disabled and aria-disabled?

`disabled` removes the control from focus and form data. `aria-disabled` only tells assistive tech, so behavior must be blocked in JavaScript.

### Do disabled inputs get submitted with the form?

No. Disabled controls are not included in form data. Use `readonly` if the value must be sent.

## Related cards

- [:enabled](https://wonderium.dev/css/enabled.md)
- [\[aria-disabled\]](https://wonderium.dev/a11y/aria-disabled.md)
- [`<button>`](https://wonderium.dev/html/button.md)
- [`<fieldset>`](https://wonderium.dev/html/fieldset.md)
- [:read-only](https://wonderium.dev/css/read-only.md)

---

- Level: [CSS](https://wonderium.dev/css.md)
- HTML version: https://wonderium.dev/css/disabled
- Last updated: 2026-11-25
