【问题标题】:IE 11 ignores nth-child and last-childIE 11 忽略 nth-child 和 last-child
【发布时间】:2014-04-07 07:01:39
【问题描述】:

谁能告诉我为什么 IE 11 完全忽略了我的 css 文件的以下规则?

.navigation.menu ul li:nth-child(7):hover ul,
.navigation.menu ul li:nth-child(8):hover ul,
.navigation.menu ul li:last-child:hover ul {

     right:0;left:initial;

}

所有其他浏览器正在读取并按预期运行此规则,但 IE 甚至看不到它。

【问题讨论】:

    标签: css internet-explorer css-selectors


    【解决方案1】:

    假设您有正确的文档类型,我认为您的选择器不是问题,而是规则集。

    IE 不理解 initial 关键字。 (同样,Firefox 也不支持——它使用前缀 -moz-initial 来支持它。)

    由于left 的初始值为auto,因此您可以使用它来实现与浏览器的最佳兼容性:

    right:0;left:auto;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-12-10
      • 2018-02-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-03
      • 2018-08-06
      相关资源
      最近更新 更多