FIT is a CSS trick based on blueimp's jQuery File Upload that lets you make almost any element trigger the browser's file upload dialog by hiding an input[type=file]
inside of it.
It's specially useful for designers that despise the browsers' default input[type=file]
styles, which as of today cannot be changed.
Import fit.css into your CSS file, then wrap the input[type=file]
— together with some text or an icon — in an element with the class .fit
.
Remember to set the container element to have:
position: relative;
orposition: absolute;
display: inline-block;
ordisplay: block;
<span class="upload-button fit">
<input type="file">
Upload files
</span>
@import "fit.css";
span.upload-button {
/* Mandatory rules */
display: inline-block;
position: relative;
/* Your rules */
}
This trick has been tested and works properly on the latest Chrome, Safari, Firefox, Mobile Safari, Mobile Chrome, and Internet Explorer 9/10.