-
-
Save mashihua/1475170 to your computer and use it in GitHub Desktop.
Markup to Hide a File Input
This file contains 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
.fake_file_input { | |
background: url(../images/fake_file_input.png) no-repeat; | |
cursor: pointer; | |
width: 150px; | |
height: 30px; | |
overflow: hidden; | |
position: relative; | |
display: inline-block; | |
*display: inline; | |
*zoom: 1; | |
} | |
.fake_file_input input { | |
position: absolute; | |
top: 0; | |
left: -99999px; | |
opacity: 0; | |
filter: alpha(opacity=0); | |
-ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=0)'; | |
} | |
/* | |
Hack for Firefox: | |
*/ | |
@-moz-document url-prefix() { | |
.fake_file_input input { | |
left: 0; | |
right: 0; | |
bottom: 0; | |
width: 150px; | |
height: 30px; | |
} | |
} | |
/* | |
Degrade for IE6: | |
*/ | |
* html .fake_file_input { | |
background: none; | |
cursor: default; | |
overflow: visible; | |
position: static; | |
width: auto; | |
height: auto; | |
} | |
* html .fake_file_input input { | |
position: static; | |
filter: alpha(opacity=100); | |
} |
This file contains 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
<label for="id_of_input" class="fake_file_input"> | |
<input type="file" id="id_of_input" /> | |
</label> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment