:autofill
The :autofill pseudo-class matches <input> elements that have been filled in automatically by the browser.
Overview
The :autofill pseudo-class matches <input> elements that have been filled in automatically by the browser.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 110 | 110 | 86 | 15 | 110 | 15 | |
1+Supported (version) Not supported ※Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Notes 1 item(s)
Compatibility
- Available with a vendor prefix: -webkit- (1)
Notes 1 item(s)
Compatibility
- Available with a vendor prefix: -webkit- (79)
Notes 4 item(s)
Limitation
- This browser only partially implements this feature
Implementation note
- The `:autofill` pseudo-class matches autofilled username and password fields, but not other autocompleted fields. See bug 1923525.
- The `:-webkit-autofill` pseudo-class matches autofilled username and password fields, but not other autocompleted fields. See bug 1923525.
Compatibility
- Available with a vendor prefix: -webkit- (86)
Notes 1 item(s)
Compatibility
- Available with a vendor prefix: -webkit- (3)
Notes 1 item(s)
Compatibility
- Available with a vendor prefix: -webkit- (18)
Notes 1 item(s)
Compatibility
- Available with a vendor prefix: -webkit- (1)
Syntax
CSS
input:autofill {
background-color: #e8f0fe;
border: 1px solid #4285f4;
color: #333;
} Live demo
Use cases
Control styling
Use :autofill to shape how interactive elements respond or appear in real UI states.
Input-aware behavior
Refine controls so they better match touch, keyboard, or form workflows.
Cautions
- Do not remove native affordances unless the replacement is equally clear and usable.
- Interaction styling should be tested across browsers and input modes.
Accessibility
- Interactive CSS must preserve focus indicators and usable target sizes.
- State changes should remain perceivable without relying on color alone.
Related links
Powered by web-features