CSS :enabled Pseudo-class

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The :enabled pseudo-class matches form controls that are enabled — they can be clicked, typed into, or focused.

It is the opposite of :disabled. Use it when you want a clear “ready to use” look next to inactive controls. Most fields are enabled by default; style :enabled when the contrast matters.

Baseline · Widely available.

Not deprecated. Core form-state selector. Extremely broad browser support.

CSS Syntax

syntax.css
:enabled { /* declarations */ }

Often typed as input:enabled, button:enabled, or select:enabled.

Selector Forms

PatternMatchesTry it
input:enabledInteractive text fields and other inputsTry it
button:enabledClickable buttonsTry it
:enabled / :disabledOpposite form states side by sideTry it
select:enabledInteractive dropdownsTry it

How to Use :enabled

Leave the control interactive, then style the enabled state.

  1. Do not set disabled on the control you want to style.
  2. Write :enabled or a typed form like button:enabled.
  3. Use clear colors and cursor: pointer where helpful.
  4. Pair with :disabled so both states are obvious.
PieceRequired?Role
No disabled stateYesControl must be interactive
:enabledYesSelects that interactive state
Element typeOptionalNarrows the rule (input, button, …)
:disabledOptionalStyles the inactive opposite

Live Preview

Toggle the control between enabled and disabled. The input picks up :enabled styles when interactive.

Green border when the control matches :enabled.

Form control

Matches input:enabled

CSS Examples

Each snippet focuses on :enabled. Use Try It Yourself for a live editor.

Example 1 — Style an Enabled Input

Highlight fields that are ready for typing.

CSS
<style>
  input:enabled {
    background: #ecfdf5;
    border: 1px solid #22c55e;
  }
</style>

<label for="user">Username</label>
<input id="user" type="text" value="ready">
<input type="text" value="locked" disabled>
Try It Yourself

How It Works

  1. First input. No disabled — matches input:enabled.
  2. Green look. Signals “ready to edit.”
  3. Second input. Has disabled, so it does not match.
  4. Pairing. Often combine with a :disabled rule for contrast.

Example 2 — Style an Enabled Button

Make clickable buttons look active.

CSS
<style>
  button:enabled {
    background: #2563eb;
    color: #fff;
    cursor: pointer;
  }
</style>

<button type="button">Save</button>
<button type="button" disabled>Save (disabled)</button>
Try It Yourself

How It Works

  1. Rule. button:enabled styles only interactive buttons.
  2. Cursor. pointer reinforces that it can be clicked.
  3. Disabled sibling. Skipped by the selector.
  4. Default tip. You can style button alone if every button is enabled.

Example 3 — Enabled vs Disabled Side by Side

Give both states clear, opposite styles.

CSS
<style>
  input:enabled {
    color: #15803d;
  }

  input:disabled {
    color: #94a3b8;
  }
</style>

<input type="text" value="Enabled">
<input type="text" value="Disabled" disabled>
Try It Yourself

How It Works

  1. Two rules. One for each state.
  2. Green text. Enabled field is interactive.
  3. Gray text. Disabled field is not.
  4. Teaching pattern. Same as MDN’s side-by-side demo.

Edge Cases & Pitfalls

If styles do not apply, check these first.

default

Often optional

Bare input / button rules already style enabled controls. Use :enabled when you need an explicit pair with :disabled.

fieldset

Disabled fieldset disables children

Controls inside a disabled fieldset do not match :enabled, even without their own attribute.

aria

aria-disabled still matches :enabled

Only the HTML disabled state flips the pseudo-class. Style ARIA-only cases with [aria-disabled="true"].

div

Form controls only

:enabled targets elements that support a disabled state. Plain div/span widgets need classes or ARIA + JS.

readonly

Read-only can still be enabled

A readonly input is usually still :enabled (focusable). See :read-only for that state.

Browser Support

The :enabled pseudo-class is a browser CSS selector. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available

:enabled

Supported in all modern browsers (CSS3-era form selectors). Safe for teaching and production.

100% Core support
Google Chrome 1+
Full support
Mozilla Firefox 1+
Full support
Apple Safari 3.1+
Full support
Microsoft Edge 12+
Full support
Opera 9+
Full support
Samsung Internet 1+
Full support
Internet Explorer 9+
Full support
:enabled Universal

Bottom line: No prefixes. No polyfills. It is not a runtime API.

Key Takeaways

  • Role: style form controls that can be activated or focused.
  • Trigger: no HTML disabled state (and not inside a disabled fieldset).
  • Opposite: use :disabled for inactive controls.
  • Tip: pair both states when the UI contrast matters.

One line: :enabled styles interactive form controls so users can tell what they can use.

Frequently Asked Questions

It matches form controls that are enabled — they can be activated, edited, or focused. That means they do not have the HTML disabled state.
Controls that support the disabled attribute when they are not disabled: input, button, select, textarea, fieldset, optgroup, and option.
:enabled matches interactive controls. :disabled matches the same kinds of controls when they are inactive.
Not always. Many styles apply to the default state. Use :enabled when you want an explicit contrast next to :disabled, such as button:enabled { cursor: pointer; }.
Yes. It is Baseline Widely available and works in every modern browser. It is a CSS selector, not a Node.js or runtime API.
No. A control with only aria-disabled="true" still matches :enabled unless it also has the HTML disabled attribute.

Next: :first-child

Learn how to select the first child element inside a parent.

:first-child tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful