Created
February 20, 2013 06:34
-
-
Save pzi/4993431 to your computer and use it in GitHub Desktop.
Style input type="file" in Webkit (Chrome, Safari)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
I have the same question, but still today, in 2020, it seems impossible ! 😑
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how to use -webkit-file-upload-button CSS in safari?