开发者

IE 9 css issues or css-hacks [duplicate]

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

*** Updated *** Great discussion everyone, again thanks for the input I just want to share the information with other developers/programmers and talk about the possible 开发者_C百科solutions.

I've come up with another clever little trick that could work as well.

It's an old way of going server-side/client-side in asp, that can still be done in .NET (not that this is proper, but in the end 'they' just want it to work)

Here it is:

IE 9 css issues or css-hacks [duplicate]

This is more of a discussion than a question, but does any know of some specific IE 9 CSS hacks. I don't want to use a separate style sheet, but was wondering if there we any IE 9 hacks out yet.

For example you can do the following for the other IE's

_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. **/


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.


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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜