普通的input[type=‘file’]的效果很朴素
可以自定义一个file选择文件的按钮:
思路为:
用定位将自定义的按钮遮住原来的选择文件按钮,
再让点击自定义按钮时触发原来的选择文件按钮的事件即可
(对此,label可实现)
效果图:
源码demo:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.btn{
position: relative;
display: inline-block;
width: 75px;
height: 25px;
overflow: hidden;
text-align: center;
font-size: 14px;
line-height: 25px;
vertical-align: center;
border: 1px solid #23c6c8;
background-color: #23c6c8;
color:#fff;
border-radius: 3px;
}
.btn:hover{
border: 1px solid #23babc;
background-color: #23babc;
}
.btn input{
position: abs