上传文件input(type=file)美化。

input file 把之前的按钮透明度opacity设置为0,外层用div包裹。

 

1 <div class="uploadButDiv greenButton text-center">
2   <input type="file" accept="image/jpeg,image/jpg,image/png,image/gif"/>上传
4 </div>
.uploadButDiv {
    width: 100%;
    height: 3.25rem;
    line-height: 3.2rem;
    position: relative;
    cursor: pointer;
    color: #0057FF;
    font-size: 1.125rem;
    background: #fff;
    border: 1px solid #0057FF;
    border-radius: 4px;
    overflow: hidden;
    display: inline-block;
}

.uploadButDiv input {
    width: 100%;
    position: absolute;
    right: 0;
    top: 0;
    opacity: 0;
    cursor: pointer
}

 

posted @ 2017-09-28 14:24  Evo1uti0n  阅读(192)  评论(0编辑  收藏  举报