JSFiddle - React, Tailwind, and code Playground
by Abhay Singh
HTML
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="main">
<div class="media">
Media
</div>
<div class="uploadsec">
<div class="file" id="divfile0"><span style="width:100%;">Choose a Document <i class="fa fa-cloud-upload"></i></span><input type="file" name="Docfile" id="Docfile"></div>
<div id="filename">
</div>
</div>
</div>
CSS
body {
paddinh:0;
margin:0;
}
.main {
padding:15px;
background:#fff;
overflow:hidden;
}
.media {
width:40%;
float:left;
}
.uploadsec {
float:right;
width:60%;
overflow:hidden;
}
.file {
font-size: 10px;
letter-spacing: 0.02em;
text-transform: uppercase;
color: #ffffff;
text-align: center;
width: 100%;
position: relative;
overflow: hidden;
}
.file span {
background: transparent;
width: 70%;
height: 30px;
line-height: 30px;
font-family: 'myriadpro-regular';
font-size: 14px;
color: #666;
text-align: left;
text-transform: none;
padding-left: 10px;
box-sizing: border-box;
float: left;
}
.file i {
float: right;
width: 25%;
color: #2c75e9;
line-height: 30px;
text-align: right;
font-size: 20px;
padding-right: 5px;
box-sizing: border-box;
}
.uploadsec input[type=file] {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
opacity: 0;
position: relative;
width: 100%;
height: 35px;
font-weight: 700;
font-size: 0.5em;
line-height: 28px;
letter-spacing: 0.2em;
position: absolute;
left: 0;
top: 0;
height: 100%;
z-index: 10;
}
JavaScript
$('#Docfile').change(function () {
var filename = $(this).val().replace(/C:\\fakepath\\/i, '')
$('.filename').text(filename);
});