1

* 更新 * 大家讨论得很好,再次感谢您的意见我只想与其他开发人员/程序员分享信息并讨论可能的解决方案。

我想出了另一个聪明的小技巧,它也可以工作。

这是在 asp 中进行服务器端/客户端的一种旧方式,仍然可以在 .NET 中完成(并不是说这是正确的,但最终“他们”只是希望它工作)

这里是:

在此处输入图像描述

这更像是一个讨论而不是一个问题,但是否知道一些特定的 IE 9 CSS hack。我不想使用单独的样式表,但想知道我们是否有任何 IE 9 破解了。

例如,您可以对其他 IE 执行以下操作

_CSS_thing {css} /** IE 6 **/

*CSS_thing {css} /** IE 7 **/

.CSS_thing {margin-top:0px/0\} /** IE 8 -- could be wrong on the /\ format is one of those ways don't really use that one. **/

谢谢。

考斯

4

2 回答 2

3

Rather than using hacks specifically for IE, why don't you use conditional comments instead? Check out the HTML5Boilerplate and how they deal with IE-specific styles.

More specifically, you can use conditional comments to add classes to the <html> or <body> elements, and then in your stylesheet, use those classes to target styles that fix specific IE problems or differences.

Here's the excerpt from the HTML5Boilerplate project that does this:

<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7 ]> <html class="no-js ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]>    <html class="no-js ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]>    <html class="no-js ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--> <html class="no-js" lang="en"> <!--<![endif]-->

The comments will cause IE to use a particular version of the <html> tag that has a class in it that corresponds to a particular version of IE. Using this same concept, you can easily extend to IE9, or to have other classes added to deal with IE-specific behaviors.

于 2011-04-21T14:33:27.503 回答
0

I don't know of any CSS hacks to target IE9. Sorry.

You're stuck with conditional comments.

The real question is: why do you think you need to provide IE9 with different styles?

IE9 is a mostly standards compliant browser, unlike its predecessors.

于 2011-04-21T14:36:07.637 回答