Skip to content

Instantly share code, notes, and snippets.

@adambene
Created December 5, 2016 18:42
Show Gist options
  • Save adambene/2879992d551935bcee7f3b9383744578 to your computer and use it in GitHub Desktop.
Save adambene/2879992d551935bcee7f3b9383744578 to your computer and use it in GitHub Desktop.
Custom File Upload Button With Pure CSS
<div class="upload-btn-wrapper">
<button class="btn">Upload a file</button>
<input type="file" name="myfile" />
</div>
.upload-btn-wrapper {
position: relative;
overflow: hidden;
display: inline-block;
}
.btn {
border: 2px solid gray;
color: gray;
background-color: white;
padding: 8px 20px;
border-radius: 8px;
font-size: 20px;
font-weight: bold;
}
.upload-btn-wrapper input[type=file] {
font-size: 100px;
position: absolute;
left: 0;
top: 0;
opacity: 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment