【问题标题】:overflow-x not working in IE8溢出-x 在 IE8 中不起作用
【发布时间】:2017-12-22 20:54:43
【问题描述】:

我在 IE 中遇到overflow-x:hidden 的问题。所有其他浏览器似乎都接受它,但 IE 会创建 overflow-x:hidden(x 和 y)。

有人对 IE 修复有任何提示吗?

【问题讨论】:

  • 解决了:-ms-overflow-x
  • 这一定是个误会。 IE 从版本 5 开始支持 overflow-x。同义词 -ms-overflow-x 是在版本 8 中添加的,但不应使用它。您一定做了其他事情,实际上改变了这种情况。
  • 这提供了对“-ms-overflow-style”的很好的详细描述:developer.mozilla.org/en-US/docs/Web/CSS/-ms-overflow-style

标签: css internet-explorer internet-explorer-8


【解决方案1】:

由于 -ms-overflow-x 正在工作,因此您的 DOCTYPE 声明可能存在问题。

here

备注

Windows Internet Explorer 8。-ms-overflow-x 属性是 CSS 的扩展,在 IE8 中可以用作 overflow-x 的同义词 标准模式。

对于 Microsoft Internet Explorer 6 及更高版本,当您使用 !DOCTYPE 声明以指定标准兼容模式,这 属性适用于 html 对象。

【讨论】:

    【解决方案2】:

    我能够通过添加以下内容来解决我在 IE8 中遇到的相同问题:

        position: relative;
    

    到需要overflow-x: hidden 功能的div。

    如果没有 div 上的相对定位,即使我设置了 overflow-x: hidden,我的内容也会显示在 div 之外。

    【讨论】:

      【解决方案3】:

      Svbaker的回答也是正确的。试试这个对我有用。

          <div style="overflow: auto;
                      overflow-y: hidden;
                      -ms-overflow-y: hidden;
                      white-space: nowrap;
                      position:relative;
                      ">
                       ...somecodes..
          </div>
      

      -ms-overflow-y:隐藏; - 这适用于 IE8 只需记住添加 position:relative 因为 overflow-y/x 适用于 CSS3 并且适用于更高版本的浏览器。

      【讨论】:

        【解决方案4】:

        yah overflow-x 和 y 是 css3 规范。

        尝试使用像 http://baijs.nl/tinyscrollbar/ 这样的 jquery 插件

        否则我猜你是想隐藏元素的“宽度”?为什么不 1.将元素的宽度设置为特定大小 2.设置溢出:隐藏 3. 设置高度为自动

        【讨论】:

        • 不需要。该属性得到很好的支持,包括IE 5+:developer.mozilla.org/en-US/docs/CSS/overflow-x
        • 这是我的文档类型。&lt;!DOCTYPE html&gt; &lt;!--[if lt IE 7]&gt; &lt;html class="no-js lt-ie9 lt-ie8 lt-ie7"&gt; &lt;![endif]--&gt; &lt;!--[if IE 7]&gt; &lt;html class="no-js lt-ie9 lt-ie8"&gt; &lt;![endif]--&gt; &lt;!--[if IE 8]&gt; &lt;html class="no-js lt-ie9"&gt; &lt;![endif]--&gt; &lt;!--[if gt IE 8]&gt;&lt;!--&gt; &lt;html class="no-js"&gt; &lt;!--&lt;![endif]--&gt;
        • 任何说“使用这个jquery插件”的答案都应该被禁止
        猜你喜欢
        • 2014-08-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-08-02
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多