Skip to content

Instantly share code, notes, and snippets.

@dkesberg
Created April 17, 2014 13:22
Show Gist options
  • Save dkesberg/10983003 to your computer and use it in GitHub Desktop.
Save dkesberg/10983003 to your computer and use it in GitHub Desktop.
file input styling for bootstrap 3
.btn-file {
position: relative;
overflow: hidden;
}
.btn-file input[type=file] {
position: absolute;
top: 0;
right: 0;
min-width: 100%;
min-height: 100%;
font-size: 999px;
text-align: right;
filter: alpha(opacity=0);
opacity: 0;
background: red;
cursor: inherit;
display: block;
}
input[readonly] {
background-color: white !important;
cursor: text !important;
}
<div class="input-group">
<span class="input-group-btn">
<span class="btn btn-default btn-file">
Browse...
<input data-url="/upload" accept="image/jpeg" name="image" type="file" id="image">
</span>
</span>
<input readonly="readonly" placeholder="Picture file" class="form-control" name="filename" type="text">
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment