【问题标题】:Advise on resolving pseudo-class compatibility for IE8关于解决 IE8 伪类兼容性的建议
【发布时间】:2014-11-20 16:14:15
【问题描述】:

我在项目中使用了伪类,我目前正在处理它,因为它已经是大量的 javascript,所以我试图避免使用 selectivizr。有没有办法让 psedoclass 与 IE8 兼容?是否可以使用 Modernizr 来解决此问题?

任何建议将不胜感激。

【问题讨论】:

  • 哪些伪类? :link:hover:first-child 等基本的都适用于 IE8。
  • 我正在处理第一个孩子、最后一个孩子和第 n 个孩子。所以我对 last-child 和 nth-child 有疑问。

标签: internet-explorer-8 modernizr pseudo-class selectivizr


【解决方案1】:

您可以使用 Modernizr 检查 css-lastchild(您可以在 非核心检测 部分找到它)并在浏览器不支持 css-lastchild 时自定义您的样式 - 这将意味着它也不支持任何其他 CSS3 选择器,它们是:

  • :root
  • :nth-child()
  • :nth-last-child()
  • nth-of-type
  • nth-last-of-type()
  • :last-child
  • :first-of-type
  • :last-of-type
  • :only-child
  • :only-of-type
  • :empty
  • :target
  • :enabled
  • :disabled
  • :checked
  • :not().

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-06-16
    • 1970-01-01
    • 2020-11-25
    • 2014-08-14
    • 2011-10-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多