coderef

::file-selector-buttonBaseline · Widely available

The ::file-selector-button CSS pseudo-element selects the button of a <input type="file"> element.

Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Apr 26, 2021. Widely available since Oct 26, 2023.

Browser support

DesktopChrome
1–88Not supported
89+Supportedsince Mar 2, 2021
Current: 155
Edge
12–88Not supported
89+Supportedsince Mar 4, 2021
Current: 154
Firefox
1–81Not supported
82+Supportedsince Oct 20, 2020
Current: 157
Safari
1–14Not supported
14.1+Supportedsince Apr 26, 2021
Current: 27
MobileChrome Android
18–88Not supported
89+Supportedsince Mar 2, 2021
Current: 155
Firefox Android
4–81Not supported
82+Supportedsince Oct 20, 2020
Current: 157
Safari iOS
1–14Not supported
14.5+Supportedsince Apr 26, 2021
Current: 27

How to use

This feature is Baseline widely available — use it freely, no fallback needed.

Example

Full syntax and examples are on MDN: ::file-selector-button.

Feature detection

CSS · check before using
@supports selector(:file-selector-button) {
  /* styles that use :file-selector-button */
}

/* or in JavaScript */
if (CSS.supports("selector(:file-selector-button)")) {
  // use it
}