The :enabled pseudo-class matches form elements that are interactive and not disabled. Use it to give clear visual feedback about which controls users can interact with.
01
Interactive
Can be used.
02
Form controls
input, button.
03
vs :disabled
Opposite state.
04
Scoped
button:enabled.
05
Hover/focus
Combine states.
06
Default state
Most fields.
Fundamentals
Introduction
The :enabled selector in CSS is a pseudo-class used to match form elements that are currently enabled and can be interacted with by the user.
It works with controls that support the disabled attribute, such as <input>, <button>, <select>, <textarea>, <fieldset>, and <optgroup>.
Definition and Usage
Append :enabled to a selector with no space before the colon: input:enabled or button:enabled. Styles apply whenever the element does not have the disabled attribute and is not otherwise inactive.
💡
Beginner Tip
Most form fields are enabled by default. Pair :enabled with :disabled to create a clear visual contrast between active and inactive controls in the same form.
Only form controls that support disabled can match :enabled.
Elements without a disabled attribute are enabled by default.
Combine with type selectors: input[type="text"]:enabled.
Chain with other pseudo-classes: button:enabled:hover.
Use alongside :disabled for complete form state styling.
Supported Elements
Element
Supports :enabled
<input>
Yes (text, checkbox, radio, etc.)
<button>
Yes
<select>
Yes
<textarea>
Yes
<fieldset>
Yes (when not disabled)
<div>, <p>
No (no disabled state)
Related Selectors
:disabled — matches inactive form controls
:focus — matches when an enabled control has keyboard focus
:hover — matches on mouse-over (enabled controls only respond to clicks)
:read-only / :read-write — text field editability states
Cheat Sheet
⚡ Quick Reference
Question
Answer
Selector type
Pseudo-class
When it applies
Form control is interactive (not disabled)
Default state
Most controls are enabled unless disabled is set
Opposite
:disabled
Common pattern
button:enabled { cursor: pointer; }
Browser support
All modern browsers
Context
When to Use :enabled
:enabled helps users understand which controls are active:
Form validation — Style fields that become enabled after a prerequisite is met.
Button states — Give enabled submit buttons a strong call-to-action appearance.
Contrast with disabled — Green borders for active fields, gray for locked ones.
Conditional forms — Highlight inputs that open up when a checkbox is checked.
Cursor feedback — Set cursor: pointer on enabled buttons only.
Preview
👀 Live Preview
Enabled controls get green styling; disabled controls appear grayed out:
Hands-On
Examples Gallery
Practice :enabled with form styling, scoped button rules, hover combinations, and mixed enabled/disabled forms.
📜 Core Patterns
Style interactive form controls and contrast them with disabled ones.
Example 1 — Enabled vs disabled form controls
Apply green styling to all enabled controls and gray styling to disabled ones in the same form.
enabled-form.html
<style>:enabled{border:2px solid #22c55e;background-color:#ecfdf5;}:disabled{border:2px solid #94a3b8;background-color:#f1f5f9;cursor:not-allowed;}</style><form><inputtype="text"placeholder="Enter your name"><inputtype="text"placeholder="Locked field"disabled><buttontype="submit">Submit</button><inputtype="checkbox"id="agree"><labelfor="agree">I agree to the terms</label></form>
select and textarea support the disabled attribute just like inputs, so :enabled and :disabled work on them too.
Watch Out
⚠️ Common Pitfalls
Non-form elements — :enabled has no effect on <div>, <span>, or <a> because they lack a disabled state.
Redundant styling — If all fields are enabled, styling the base selector may be simpler than adding :enabled.
Specificity order — Place :disabled rules after :enabled when both set the same properties.
Fieldset inheritance — Disabling a <fieldset> disables all nested controls; they will not match :enabled.
Read-only vs disabled — A read-only input is still :enabled; use :read-only for that state.
A11y
♿ Accessibility
Do not rely on color alone — Pair green/red borders with labels or helper text explaining why a field is disabled.
Keep disabled fields in tab order when needed — Or use aria-disabled with careful styling if you need custom behavior.
Focus styles — Style :enabled:focus so keyboard users can see which active field is focused.
Explain locked fields — Tell users why a control is disabled (e.g., “Complete step 1 first”).
🧠 How :enabled Works
1
Browser checks the control
For each form element, the browser reads whether the disabled attribute is present.
State
2
:enabled matches active controls
Elements without disabled and that accept user input match the pseudo-class.
Match
3
Styles apply
Your CSS gives visual feedback that the control is interactive.
Render
=
✅
Clear interaction cues
Users instantly see which form controls they can use.
Compatibility
🖥 Browser Compatibility
The :enabled pseudo-class is supported in all modern browsers on form controls. It has been part of CSS since Selectors Level 3.
✓ Baseline · Universal support
Form state styling everywhere
:enabled works reliably in Chrome, Firefox, Safari, Edge, and Opera.
99%Universal support
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions
Full support
OperaAll modern versions
Full support
:enabled pseudo-class99% supported
Bottom line::enabled is safe for production form styling alongside :disabled.
Wrap Up
🎉 Conclusion
The :enabled pseudo-class is a straightforward way to style interactive form controls. Combined with :disabled, it helps users instantly recognize which fields and buttons they can use.
Scope it to specific elements like button:enabled, chain it with :hover and :focus, and always consider accessibility when communicating form state visually.
Use these points when styling interactive form controls.
5
Core concepts
✅01
Interactive
Not disabled.
Purpose
📝02
Form controls
input, button.
Targets
🚫03
vs :disabled
Opposite pair.
Pattern
👆04
+ hover/focus
Chain states.
Combo
🌐05
99% support
All browsers.
Compat
❓ Frequently Asked Questions
The :enabled pseudo-class matches form elements that are currently interactive — they do not have the disabled attribute and can receive user input.
Form controls that support the disabled attribute: input, button, select, textarea, fieldset, and optgroup. Elements without a disabled state are always considered enabled.
:enabled matches interactive form controls. :disabled matches the opposite — elements with the disabled attribute or that are otherwise inactive.
Often you style the default state directly and use :disabled for inactive fields. :enabled is useful when you want explicit contrast, such as button:enabled { cursor: pointer; } alongside button:disabled.
Yes. All modern browsers support :enabled on form controls. It has been available since CSS3.