Style File Input

by fizerkhan

HTML

<p>
    So various methods prevent file upload inputs from being styled conveniently. But that needn't be the case!
</p>
<label class="fileContainer">
    Click here to trigger the file uploader!
    <input type="file"/>
</label>

JavaScript

.fileContainer {
    overflow: hidden;
    position: relative;
}
 
.fileContainer [type=file] {
    cursor: inherit;
    display: block;
    font-size: 999px;
    filter: alpha(opacity=0);
    min-height: 100%;
    min-width: 100%;
    opacity: 0;
    position: absolute;
    right: 0;
    text-align: right;
    top: 0;
}