我是靠谱客的博主 精明小鸭子,这篇文章主要介绍css修改input type="file" 文件的默认上传upload样式,现在分享给大家,希望可以做个参考。

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!DOCTYPE> <html> <head> <title>CSS修改默认的input标签中file(文件上传)样式</title> <meta charset = "utf-8" /> <style type="text/css"> *{ margin:0; padding:0; font-size:12px; } .wrap{ position:relative; overflow:hidden; margin-right:4px; display:inline-block; padding:4px 10px; line-height:18px; text-align:center; vertical-align:middle; cursor:pointer; background:#D8450B; border:1px dotted #D8450B; border-radius:4px; -webkit-border-radius:4px; -moz-border-radius:4px; } .wrap span{ color:#FFF; } .wrap .file{ position:absolute; top:0; right:0; margin:0; border:solid transparent; opacity:0; filter:alpha(opacity=0); cursor: pointer; } </style> </head> <body> <form action=""> <table> <tr> <td>默认样式:</td> <td><input type="file" /></td> </tr> <tr> <td>修改后样式:</td> <td> <div class="wrap"> <span>添加附件</span> <input id="fileupload" class="file" type="file" /> </div> </td> </tr> </table> </form> <p>主要思想是:把file/input(position:absolute)使用一个div(position:relative)包装起来,然后再将file/input给隐藏起来,那就实现了修改样式的效果,其实并非真正修改了file/input的样式,而是利用wrap的样式遮盖了file/input。</p> </body> </html>

原文地址:http://www.mafutian.net/85.html

最后

以上就是精明小鸭子最近收集整理的关于css修改input type="file" 文件的默认上传upload样式的全部内容,更多相关css修改input内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(60)

评论列表共有 0 条评论

立即
投稿
返回
顶部