Skip to content

Instantly share code, notes, and snippets.

@pzi
Created February 20, 2013 06:34
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pzi/4993431 to your computer and use it in GitHub Desktop.
Save pzi/4993431 to your computer and use it in GitHub Desktop.
Style input type="file" in Webkit (Chrome, Safari)
input[type=file] {
position: relative;
-webkit-appearance: textfield;
-webkit-box-sizing: border-box;
}
input[type=file]::-webkit-file-upload-button {
border: none;
margin: 0;
padding: 0;
-webkit-appearance: none;
width: 0;
}
/* "x::-webkit-file-upload-button" forces the rules to only apply to browsers that support this pseudo-element */
x::-webkit-file-upload-button, input[type=file]:after {
content: 'Browse...';
display: inline-block;
left: 100%;
margin-left:3px;
padding: 3px 8px 2px;
position: relative;
-webkit-appearance: button;
}
@RA344710
Copy link

RA344710 commented Jan 8, 2018

how to use -webkit-file-upload-button CSS in safari?

@MrZyr0
Copy link

MrZyr0 commented Dec 24, 2020

I have the same question, but still today, in 2020, it seems impossible ! 😑

@pzi
Copy link
Author

pzi commented Jan 12, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment