文件上传的控件,如果是浏览器原生的话,可能不符合需求的风格,怎么办呢,最简单粗暴的方法是,让自定义样式和原生控件的大小设置成一样,然后把原生的控件透明度设置成0,再通过margin:-xxx来调整位置就可以了
<div >
<input type="file" style=" width: 122px;opacity: 0;height: 34px"/>
<img src="../assets/images/leading_in.png" style="margin-left: -122px"/>
</div>
把自定义覆盖在上面,就是这么的简单粗暴。