定义input type=file 样式的方法
来源:互联网 发布:江阴网络女主播被杀 编辑:程序博客网 时间:2024/05/19 00:36
定义input type=file 样式的方法
详情请参考以下代码
<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>定义input type="file" 的样式</title><style type="text/css">body{ font-size:14px;}input{ vertical-align:middle; margin:0; padding:0}.file-box{ position:relative;width:340px}.txt{ height:22px; border:1px solid #cdcdcd; width:180px;}.btn{ background-color:#FFF; border:1px solid #CDCDCD;height:24px; width:70px;}.file{ position:absolute; top:0; right:80px; height:24px; filter:alpha(opacity:0);opacity: 0;width:260px }</style></head><body><div class="file-box"> <form action="" method="post" enctype="multipart/form-data"> <input type='text' name='textfield' id='textfield' class='txt' /> <input type='button' class='btn' value='浏览...' /> <input type="file" name="fileField" class="file" id="fileField" size="28" onchange="document.getElementById('textfield').value=this.value" /> <input type="submit" name="submit" class="btn" value="上传" /> </form></div></body></html>
使用该代码后,效果如下:
注意:
如果想使用input 框往右移动,.txt增加margin-left:60px;的同时,需要将.file设置对应的移动位置,如下
.txt{ height:22px; border:1px solid #cdcdcd; width:180px;margin-left: 60px;}
.file{ position:absolute; left:60px;top:0; right:80px; height:24px; filter:alpha(opacity:0);opacity: 0;width:260px }
上面这两段使用文件上传框整体向右移动60px;的距离
0 0
- 定义input type=file 样式的方法
- 定义input type=file 样式的方法
- 定义input type=file 样式的方法
- 定义input type=file 样式的方法
- 定义input type=file 样式的方法
- html定义input type=file 样式的方法
- 定义input type=file 样式的方法
- 定义input type=file 样式
- 定义input type=file 样式的方法,使用一个text和一个button模拟
- 定义input type=file 样式的方法,使用一个text和一个button模拟
- type=file的input框样式修改的方法
- [JS实例] input type=file 自定义样式的方法
- input type="file" 样式的模仿
- input[type="file"]的样式修改
- 自定义input[type=”file”]的样式
- input,type="file"的样式修改
- 美化input type="file"的样式
- 定义input type=file
- 英雄拖拽换装之一
- JAX-WS创建和处理SOAP消息
- Canvas的常用操作速查表
- android如何让service不被杀死
- Ubuntu常用命令操作(2)
- 定义input type=file 样式的方法
- Docker 从入门到放弃(一)
- springmvc与struts2的区别
- 使用PIE对IE8进行border-redius兼容介绍
- AC自动机简易版
- Android开发之Service
- LeetCode | Best Time to Buy and Sell Stock
- linux发布war包应用的常用命令
- primary和unique的区别