<label class="inputFile">
<span class="inputFile-custom"></span>
<input type="file" id="file">
</label>
.inputFile {
position: relative;
display: inline-block;
cursor: pointer;
height: 1.5rem;
}
.inputFile input {
margin: 0;
filter: alpha(opacity=0);
opacity: 0;
}
.inputFile-custom {
text-align: left;
position: absolute;
top: 0;
right: 0;
left: 0;
z-index: 5;
height: 1.5rem;
padding: .5rem 1rem;
line-height: 1.5;
color: #444;
background-color: #f1f1f1;
border: 1px solid #ddd;
border-radius: 3px;
box-shadow: inset 0 .5px .5px rgba(0, 0, 0, .05);
user-select: none;
}
.inputFile-custom:before {
position: absolute;
top: -1px;
right: -1px;
bottom: -1px;
z-index: 6;
display: block;
content: "Browse";
height: 1.5rem;
padding: .5rem 1rem;
line-height: 1.5;
color: #f1f1f1;
background-color: #333;
border: 1px solid #333;
border-radius: 0 3px 3px 0;
}
.inputFile-custom:after {
content: "Choose file...";
}
/* env styles */
body {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
background: #f9f9f9;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.