【问题标题】:Styling file input button with IE8用 IE8 设计文件输入按钮
【发布时间】:2014-01-22 10:31:47
【问题描述】:

我在这里基本上使用这种方法:https://coderwall.com/p/uer3ow 来设置我的文件输入部分的样式,但它似乎在 IE8 中不起作用;我看到的只是一个大按钮的一角。

HTML:

<div class="upload_btn">
    <span>Choose File</span>
    <input type="file" name="item_file_upload_1" id="item_file_upload_1">
</div>

CSS:

.forms .upload_btn {
    position: relative;    
    display: inline-block;
    text-align: center;
    width: 97px;
    height: 27px;
    font-weight: 300;
    font-size: 16px;
    line-height: 27px;
    color: #393d59;
    border: 2px solid #b9c0d6;
    overflow: hidden;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    border-radius: 5px;
}

.forms .upload_btn > input[type="file"] {
    position: absolute;
    cursor: pointer;
    top: 0;
    right: 0;
    font-size: 200px;
    opacity: 0;
}

【问题讨论】:

    标签: css internet-explorer-8 opacity


    【解决方案1】:

    使用标签技术有一种更好的、跨浏览器兼容的、语义化的、完全可访问的和纯 CSS 的方式。关于如何实施的好帖子:https://benmarshall.me/styling-file-inputs/

    【讨论】:

      【解决方案2】:

      好的,修改这个答案:https://stackoverflow.com/a/1948200/472501

      我能够为 IE8 应用以下 CSS 来解决问题:

      .forms .upload_btn > input[type="file"] {
          filter: alpha(opacity=0);
      }
      

      【讨论】:

        猜你喜欢
        • 2016-02-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-10-13
        • 2012-10-01
        • 1970-01-01
        • 1970-01-01
        • 2015-05-28
        相关资源
        最近更新 更多