我正在尝试使用自定义 < input type="file"> 按钮。这适用于 chrome 和 FF。如何让它在 IE 10 及更高版本中工作?
IE的问题是浏览框打不开。
html:
<button type="button" id="fileT"><input type="file" id="file"></button>
CSS:
#fileT{
overflow: hidden;
position: relative;
}
#fileT input {
position: absolute;
opacity: 0.1
}
最佳答案
我明白你的意思了:因为<input type="file"/>
很难设计,你需要一个容器。
然后尝试使用 <div>
而不是 <button>
.
只需确保指定高度和宽度,因为 div 内容将被绝对定位(因此从流中剥离)。
<div id="fileT">
<input type="file" id="file" />
</div>
#fileT{
overflow: hidden;
position: relative;
width: 75px;
height: 50px;
}
#fileT input {
position: absolute;
opacity: 0.5;
}
关于javascript - 自定义 <input type ="file"> 在 IE 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25991907/