type=file按钮样式改造
2017-10-08 09:00
489 查看
html:
<div class="file-wrap">
<input type="file" id="myfile" name="myfile" accept=".png,.jpeg,.jpg,.gif"/>
选择图片
</div>
css:
.file-wrap {
position: relative;
width: 119px;
height: 37px;
border-radius: 4px;
background-color: #ed4040;
background-repeat: no-repeat;
background-position: 0 0;
background-attachment: scroll;
line-height: 37px;
text-align: center;
font-size: 16px;
color: white;
cursor: pointer;
overflow: hidden;
float: left;
margin-right: 20px;
z-index: 1;
}
.file-wrap input {
position: absolute;
width: 119px;
height: 40px;
line-height: 40px;
font-size: 0;
opacity: 0;
-moz-opacity: 0;
left: 0px;
top: 0px;
cursor: pointer;
z-index: 2;
}
font-size:0;是关键。
<div class="file-wrap">
<input type="file" id="myfile" name="myfile" accept=".png,.jpeg,.jpg,.gif"/>
选择图片
</div>
css:
.file-wrap {
position: relative;
width: 119px;
height: 37px;
border-radius: 4px;
background-color: #ed4040;
background-repeat: no-repeat;
background-position: 0 0;
background-attachment: scroll;
line-height: 37px;
text-align: center;
font-size: 16px;
color: white;
cursor: pointer;
overflow: hidden;
float: left;
margin-right: 20px;
z-index: 1;
}
.file-wrap input {
position: absolute;
width: 119px;
height: 40px;
line-height: 40px;
font-size: 0;
opacity: 0;
-moz-opacity: 0;
left: 0px;
top: 0px;
cursor: pointer;
z-index: 2;
}
font-size:0;是关键。
相关文章推荐
- css input[type=file] 样式美化,input上传按钮美化
- css input[type=file] 样式美化,input上传按钮美化
- css input[type=file] 样式美化,input上传按钮美化
- css input[type=file] 样式美化,input上传按钮美化
- input[type=file] 样式美化,input上传按钮美化,使用ajax上传无须控件上传文件
- 上传按钮样式优化 <input type="file" />
- 图片提交按钮样式修改 input type=file
- css input[type=file] 样式美化,input上传按钮美化
- css input[type=file] 样式美化,input上传按钮美化
- css input[type=file] 样式美化,input上传按钮美化
- css input[type=file] 样式美化,input上传按钮美化
- <input type="file" name="file"> 上传表单域浏览按钮样式更改
- css input[type=file] 样式美化,input上传按钮美化
- css input[type=file] 样式美化,input上传按钮美化
- input[type=file] 样式美化,input上传按钮美化
- css input[type=file] input[type=radio] input[type=checkbox]样式美化,input上传按钮美化
- css input[type=file] 样式美化,input上传按钮美化
- css input[type=file] 样式美化,input上传按钮美化
- css input[type=file] 样式美化,input上传按钮美化
- <input type="file">中怎设置按钮的样式