Created
December 5, 2016 18:42
-
-
Save adambene/2879992d551935bcee7f3b9383744578 to your computer and use it in GitHub Desktop.
Custom File Upload Button With Pure CSS
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
<div class="upload-btn-wrapper"> | |
<button class="btn">Upload a file</button> | |
<input type="file" name="myfile" /> | |
</div> |
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
.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