开发者

Non-IE6 IE7 hack [duplicate]

This question already has answers here: Detecting IE version using CSS Capability/Feature Detection (18 answers) Closed 3 months ago.

I managed to create a page the crashes IE6 and 7 regularly as per here: http://raven-seo-tools.com/blog/2675/crash-ie6-with-only-css

I have a solution for non-IE browsers (display: inline-block), but the only way to get IE6/7 working is to use different CSS (display: inline). Normally I would have other browsers use inline-block, then in a seperate IE67 CSS file I would set display to inline.

The problem is IE67 crash as soon as they reach the display: inline-block line, so I need a way to hide this code from IE6 and 7 but not other browsers.

UPDATE:

Conditional Comments are not an option! IE67 crash a开发者_StackOverflow社区s soon as they reach the line for other browers, so the conditional css will never run. I need a way to hide this line from IE67. Contional Comments don't allow you to hide CSS from IE67.

UPDATE 2:

Ok, looks like conditional comments are an option. Giving the right answer to the person who gave me exactly what I was looking for though.


Use the html>/**/body hack.

html>/**/body .someclass {
    /* Will be applied on everything but IE6/IE7. */
}


These conditional comments might work. mincss.css is loaded in IE8 and other browsers, while ie6-7.css is loaded in IE7 and below.

<!-- <![if (!IE)|(gte IE 8)]> -->
    <link rel="stylesheet" href="maincss.css" type="text/css" />
<!-- <![endif]> -->
<!-- <![if (lte IE 7)]>
    <link rel="stylesheet" href="ie6-7.css" type="text/css" />
<![endif]> -->


Conditional Comments work very well for problems such as this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜