为什么不是:nth-​​child在IE9工作? [英] Why isn't :nth-child working in IE9?

查看:86
本文介绍了为什么不是:nth-​​child在IE9工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据此页面,:nth-​​child应该在IE9中工作,我之前已经尝试过它工作正常,但在此页面,它似乎不工作。在Chrome中查看网页以查看预期行为,在IE中,您将看到它无法正常工作。你可以用一个web检查器看到这个,但为了参考,CSS的相关行是:

According to this page, :nth-child should work in IE9, and I have tried it before and it worked fine, but on this page, it does not appear to be working. View the page in Chrome to see the intended behavior, and in IE, you'll see that it does not work. You can probably see this with a web inspector, but for your reference, the relevant lines of CSS are;

.ad_widget:nth-child(3n+2) { background: #efefef; }
.ad_mrow {background: #efefef;}`

。任何想法?

推荐答案

由于某种原因,我不能fathom,IE9默认为兼容模式查看内部网站,作为文件存储在PC上。兼容模式意味着渲染东西像一个愚蠢的旧浏览器。这意味着,当你设计的网站的东西,你试图从你最喜欢的IDE在IE9预览,没有一个CSS3东西工作。您必须在IE9菜单中单击工具 - >兼容性视图设置,然后取消选中兼容性视图中显示interanet网站的复选框。从那时起,这个可怕的浏览器像任何可怕的浏览器,如Safari。他们为什么这样做?天堂只知道,但是我花了我很多时间去发现这个简单的修复,因为我一直责怪我的代码。

For some reason I cannot fathom, IE9 defaults to compatibility mode for looking at intranet sites, or an HTML page stored as a file on a PC. Compatibility mode means 'render stuff like a dumb old browser'. This means that when you're designing stuff for a website and you try to preview from your favourite IDE in IE9, none of the CSS3 stuff works. You have to click on Tools ->' compatibility view settings' in the IE9 menu and then unclick the pesky checkbox that says 'display interanet sites in compatibility view'. From then on the wretched browser works like any sane browser such as Safari. Why did they do it? Heaven only knows, but it has taken me ages to discover this simple fix due to the fact that I kept blaming my code.

这篇关于为什么不是:nth-​​child在IE9工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆