css部分:
.pickFileBox{
position: relative;
display: inline-block;
background: #D0EEFF;
border: 1px solid #99D3F5;
border-radius: 8px;
padding: 4px 12px;
overflow: hidden;
color: #1E88C7;
text-decoration: none;
text-indent: 0;
line-height: 20px;
}
.pickFileBox input{
position: absolute;
font-size: 100px;
right: 0;
top: 0;
opacity: 0
}
html部分:
<div class="pickFileBox">
选择文件
<input type="file" name="" id="" value="" class="pickImg" accept="image/*"/>
</div>
//accept="image/*" 加上这个属性,是只接受图片格式的文件
自定义input=file样式
猜你喜欢
转载自blog.csdn.net/qq_34543252/article/details/79879962
今日推荐
周排行