CSS ::file-selector-button Pseudo-Element

Beginner
2 examples
Updated: Nov 2026

Definition and Usage

The ::file-selector-button pseudo-element targets the button portion of an <input type="file"> control so you can align it with your form design.

CSS Syntax

syntax.css
input[type="file"]::file-selector-button {
  background: #2563eb;
  color: white;
  border: 0;
}

Key Uses

PatternPurposeTry it
::file-selector-buttonThe file picker button inside the controlTry it
:hoverChange the button on hoverTry it

CSS Examples

Brand the Browse button

example.css
::file-selector-button {
  background: #2563eb;
  color: #fff;
  border: 0;
  padding: .5rem .9rem;
  border-radius: 8px;
}
Try It Yourself

Browser Support

::file-selector-button is a CSS selector.

✓ Selectors

::file-selector-button

Supported in modern browsers.

94% Modern browsers
Google Chrome Recent
Full support
Mozilla Firefox Recent
Full support
Apple Safari Recent
Full support
Microsoft Edge Recent
Full support
::file-selector-button Modern support

Bottom line: Safe for modern sites. Keep readable defaults without the selector.

Frequently Asked Questions

Only the button part of a file input, not the filename text.
Some older code uses ::-webkit-file-upload-button.
You can restyle it heavily; fully custom uploads often wrap a hidden input.
Only file inputs expose this pseudo-element.
Supported in modern browsers.

Next: :dir()

Continue with :dir().

:dir() →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

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.

2 people found this page helpful