IE11浏览器中的<input type =“ file”>定位问题

codeFreak

#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'>&nbsp;</td>
          <td class='buttonRegHead'>&nbsp;</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'>&nbsp;</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'>&nbsp;</td>
        <td class='buttonRegHead'>&nbsp;</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'>&nbsp;</td>
    </tr>
</table>

在IE10浏览器中它可以正常工作。文件输入正在按钮上方,该按钮变为可单击状态。因此,我能够浏览该文件。但是在IE11浏览器中,html文件元素位于页面顶部的某个位置,并且浏览按钮不可单击。

乔纳森·马尔祖洛

对于IE11你只需要定义CSSwidthheight你的#upload-file-container inputCSS规则

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元素

您只需要设置widthheight元素。特别是对于IE11,因为它需要一个width和,并且height它们不会被其父元素继承。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

IE11 中的 CSS 浏览器特定问题

来自分类Dev

如何在Pupeteer中定位多个相同的“ input [type =“ file”]“?

来自分类Dev

不同浏览器中的定位问题

来自分类Dev

如何检查浏览器是否支持<input type =“ time” />

来自分类Dev

如何在浏览器中获得相同的<input type =“ color”>值更改功能?

来自分类Dev

WKWebview 和 <input type="file"

来自分类常见问题

在移动Web浏览器中使用input [type ='file']捕获照片后,如何在画布上以正确的方向绘制照片?

来自分类Dev

VB.Net:如何上传<input type =“ file” ...>中的文件

来自分类Dev

在CSS中定位的问题

来自分类Dev

Vue <input type =“ file”>中的@input和@change有什么区别?

来自分类Dev

无法确定IE11中的浏览器版本

来自分类Dev

如何更改 <input type ="file"> 样式更改

来自分类Dev

iPhone中的AutoLayout定位问题

来自分类Dev

Internet Explorer中的定位问题

来自分类Dev

Internet Explorer 中的问题,定位?

来自分类Dev

<input type =“ file” />文件格式验证不适用于chrome和IE

来自分类Dev

当input type = number时,Android浏览器将输入框缩小

来自分类Dev

如果使用标签 <input type='number'...> 浏览器会拒绝非数字输入吗?

来自分类Dev

AngularJS <input [type = file]> ng-model在Firefox / Safari / Chrome中不起作用,但在IE中效果很好

来自分类Dev

IE11输入type =“ file” accept =“。xls”出现其他类别

来自分类Dev

如何从<input type =“ file”>将Excel文件上传到php服务器

来自分类Dev

JavaScript和AngularJS的简单混合,不显示HTML <input type =“ file”中的文件内容

来自分类Dev

使用 <input type=file> 上传图像和文本文件,然后在文档中显示它们

来自分类Dev

Google App Script GAS - 如何从表单中获取 <input type="file">

来自分类Dev

input type="file" 属性接受在 macbook 上的 Safari 中不起作用

来自分类Dev

如何使用 input type=file 在接受的文件类型中没有限制?

来自分类Dev

IE / Edge问题与定位元素

来自分类Dev

禁用带有隐藏输入[type = file]的表单上的文件浏览器

来自分类Dev

绝对定位的按钮未在IE11中居中

Related 相关文章

  1. 1

    IE11 中的 CSS 浏览器特定问题

  2. 2

    如何在Pupeteer中定位多个相同的“ input [type =“ file”]“?

  3. 3

    不同浏览器中的定位问题

  4. 4

    如何检查浏览器是否支持<input type =“ time” />

  5. 5

    如何在浏览器中获得相同的<input type =“ color”>值更改功能?

  6. 6

    WKWebview 和 <input type="file"

  7. 7

    在移动Web浏览器中使用input [type ='file']捕获照片后,如何在画布上以正确的方向绘制照片?

  8. 8

    VB.Net:如何上传<input type =“ file” ...>中的文件

  9. 9

    在CSS中定位的问题

  10. 10

    Vue <input type =“ file”>中的@input和@change有什么区别?

  11. 11

    无法确定IE11中的浏览器版本

  12. 12

    如何更改 <input type ="file"> 样式更改

  13. 13

    iPhone中的AutoLayout定位问题

  14. 14

    Internet Explorer中的定位问题

  15. 15

    Internet Explorer 中的问题,定位?

  16. 16

    <input type =“ file” />文件格式验证不适用于chrome和IE

  17. 17

    当input type = number时,Android浏览器将输入框缩小

  18. 18

    如果使用标签 <input type='number'...> 浏览器会拒绝非数字输入吗?

  19. 19

    AngularJS <input [type = file]> ng-model在Firefox / Safari / Chrome中不起作用,但在IE中效果很好

  20. 20

    IE11输入type =“ file” accept =“。xls”出现其他类别

  21. 21

    如何从<input type =“ file”>将Excel文件上传到php服务器

  22. 22

    JavaScript和AngularJS的简单混合,不显示HTML <input type =“ file”中的文件内容

  23. 23

    使用 <input type=file> 上传图像和文本文件,然后在文档中显示它们

  24. 24

    Google App Script GAS - 如何从表单中获取 <input type="file">

  25. 25

    input type="file" 属性接受在 macbook 上的 Safari 中不起作用

  26. 26

    如何使用 input type=file 在接受的文件类型中没有限制?

  27. 27

    IE / Edge问题与定位元素

  28. 28

    禁用带有隐藏输入[type = file]的表单上的文件浏览器

  29. 29

    绝对定位的按钮未在IE11中居中

热门标签

归档