样式<输入类型=“文件"> [英] Styling <input type="file">
本文介绍了样式<输入类型=“文件">的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能的重复:
输入类型=文件"按钮的样式
我正在尝试设计样式
但我运气不佳.我想让文本框消失,只保留按钮.我该怎么做?
解决方案
CSS 方式(基本代码在 here):
<style type="text/css">div.fileinputs {位置:相对;}div.fakefile {位置:绝对;顶部:0px;左:0px;z-索引:1;}div.fakefile 输入[类型=按钮] {/* 足够的宽度完全重叠真正的隐藏文件控件 */光标:指针;宽度:148px;}div.fileinputs input.file {位置:相对;文本对齐:右;-moz-不透明度:0;过滤器:阿尔法(不透明度:0);不透明度:0;z-索引:2;}</风格><div class="fileinputs"><input type="file" class="file"/><div class="fakefile"><input type="button" value="选择文件"/>
Possible Duplicate:
Styling an input type="file" button
I was trying to style
<input type="file">
but i have not had much luck. I want to make the textbox disappear and only keep the button. How can I do it?
解决方案
The CSS way (base code found here):
<html>
<style type="text/css">
div.fileinputs {
position: relative;
}
div.fakefile {
position: absolute;
top: 0px;
left: 0px;
z-index: 1;
}
div.fakefile input[type=button] {
/* enough width to completely overlap the real hidden file control */
cursor: pointer;
width: 148px;
}
div.fileinputs input.file {
position: relative;
text-align: right;
-moz-opacity:0 ;
filter:alpha(opacity: 0);
opacity: 0;
z-index: 2;
}
</style>
<div class="fileinputs">
<input type="file" class="file" />
<div class="fakefile">
<input type="button" value="Select file" />
</div>
</div>
</html>
这篇关于样式<输入类型=“文件">的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文