#upload-file-container {
width: 50px;
height: auto;
overflow: hidden;
}
#upload-file-container input {
position: absolute;
top: 0;
right: 0;
margin: 0;
border: solid transparent;
border-width: 0 0 100px 200px;
opacity: 0.0;
filter: alpha(opacity=100);
-o-transform: translate(250px, -50px) scale(1);
-moz-transform: translate(-300px, 0) scale(4);
direction: ltr;
cursor: pointer;
}
.buttonText {
color: #FFFFFF;
letter-spacing: normal;
font-family: Arial, sans-serif;
font-weight: bold;
font-variant: normal;
font-size: 11pt font-style: normal;
text-decoration: none;
text-transform: none;
width: 20px;
}
.buttonSpace {
height: 23px;
width: 20;
background-image: url(/portal/images/clearpixel.gif);
}
.buttonRegHead {
height: 23px;
width: 7px;
padding: 0;
margin: 0;
background-image: url(/DIPAPWebAppln/images/button_regular_head.gif);
background-repeat: no-repeat;
}
.buttonRegBody {
height: 23px;
padding: 0;
margin: 0;
background-image: url(/DIPAPWebAppln/images/button_regular_body.gif);
background-repeat: repeat-x;
}
.buttonRegTail {
height: 23px;
width: 7px;
padding: 0;
margin: 0;
background-image: url(/DIPAPWebAppln/images/button_regular_tail.gif);
background-repeat: no-repeat;
}
<html>
<table>
<tr>
<td align="left" nowrap class="formLabel">IMAGE1:<font color="red">*</font>
</td>
<TD>
<table border=0 cellspacing=0 cellpadding=0>
<tr>
<td class='buttonSpace'> </td>
<td class='buttonRegHead'> </td>
<td class='buttonRegBody'>
<div class="buttonText" id="upload-file-container">Browse
<input type="file" name="realfile1" id="realfile1" onChange="if(validate())preview(this, '1');return true;" />
</div>
</td>
<td class='buttonRegTail'> </td>
</tr>
</table>
</TD>
</tr>
</table>
</html>
我有一个带有许多文件输入的Web应用程序。我已经隐藏了所有文件元素并放置了一个按钮。在IE8到IE10浏览器中,这可以正常工作。但不是在IE11中。以下是我的代码段:
<style>
#upload-file-container {
width:50px;
height: auto;
overflow: hidden;
}
#upload-file-container input {
position: absolute;
top: 0; right: 0; margin: 0;
border: solid transparent;
border-width: 0 0 100px 200px;
opacity: 0.0;
filter: alpha(opacity=0);
-o-transform: translate(250px, -50px) scale(1);
-moz-transform: translate(-300px, 0) scale(4);
direction: ltr;
cursor: pointer;
}
.buttonText {
color: #FFFFFF;
letter-spacing: normal;
font-family: Arial, sans-serif;
font-weight: bold;
font-variant: normal;
font-size: 11pt
font-style: normal;
text-decoration: none;
text-transform: none;
width: 20px;
}
</style>
<table border=0 cellspacing=0 cellpadding=0>
<tr>
<td class='buttonSpace'> </td>
<td class='buttonRegHead'> </td>
<td class='buttonRegBody'>
<div class="buttonText" id="upload-file-container">
<%=DipapDictionary.translate(request,"Browse")%>
<input type="file" name="realfile1" id="realfile1" onChange="if(validate())preview(this, '1');return true;"/>
</div>
<td class='buttonRegTail'> </td>
</tr>
</table>
在IE10浏览器中它可以正常工作。文件输入正在按钮上方,该按钮变为可单击状态。因此,我能够浏览该文件。但是在IE11浏览器中,html文件元素位于页面顶部的某个位置,并且浏览按钮不可单击。
对于IE11你只需要定义CSSwidth
和height
你的#upload-file-container input
CSS规则
http://codepen.io/jonathan/pen/LGEJQg/?editors=110
在IE11中打开上面的链接,您将看到浏览文件输入触发器
#upload-file-container input {
width:100%;
height:100%;
}
因此,您的CSS规则如下所示:
#upload-file-container input {
position: absolute;
top: 0; right: 0; margin: 0;
border: solid transparent;
border-width: 0 0 100px 200px;
opacity: 0.0;
filter: alpha(opacity=0);
-o-transform: translate(250px, -50px) scale(1);
-moz-transform: translate(-300px, 0) scale(4);
direction: ltr;
cursor: pointer;
width:100%; /* add width */
height:100%; /* add height */
}
如果需要使CSS合适或更大,则实际上不需要使用CSStransform scale()
或transform translate()
在#upload-file-container input
元素上。
您只需要设置width
和height
元素。特别是对于IE11,因为它需要一个width
和,并且height
它们不会被其父元素继承。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句