简体   繁体   English

为解决IE8的伪类兼容性提供建议

[英]Advise on resolving pseudo-class compatibility for IE8

I have used pseudo-classes in the project, that i am currently working on, and since it is already javascript heavy I am trying to avoid using selectivizr. 我在项目中使用了伪类,目前我正在研究它,并且由于它已经变得JavaScript繁重,因此我试图避免使用selectivizr。 Is there are way making psedoclass compatible with IE8? 有没有办法使psedoclass与IE8兼容? Is it possible to use Modernizr to resolve this issue? 是否可以使用Modernizr解决此问题?

Any advise would be much appreciated. 任何建议将不胜感激。

You could check for css-lastchild with Modernizr (you'll find it in the Non-core detects section) and customize your styles if the browser doesn't support css-lastchild - which would mean it doesn't support any other of the CSS3 selectors either, which are: 您可以使用Modernizr检查css-lastchild (您可以在“ 非核心检测”部分中找到它),如果浏览器不支持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() . :not()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM