Liju
Liju

Reputation: 727

CSS not working in Internet Explorer 10 and above

Here is my code for IE9 and above:

<!--[if gte IE 9]>
<style type="text/css">
    #bottom p{
        font-size:10pt!important;
    }

    #pop_cities{
        font-size:14pt !important;
        font-weight:bold !important;
        padding-right:10px !important;
    }
</style>
<![endif]-->

How can I apply these style for the version 9 of Internet Explorer and above?

Upvotes: 2

Views: 962

Answers (2)

Liju
Liju

Reputation: 727

Conditional comments supported IE9 and below version
IE 10+ browser support @media screen

 @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
 /*css*/
}

Upvotes: 1

Robin
Robin

Reputation: 8498

Conditional comments are no longer supported: http://msdn.microsoft.com/en-us/library/ie/hh801214(v=vs.85).aspx

They don't work for version 10 and greater.

There is a hack for Internet Explorer 10, which you might want to use:

. ie10 #hack{
  /* Only works in IE10 */
}

Maybe you have to arm yourself with some JavaScript for the fight against the future versions of Internet Explorer, if you can't fix the underlying problem. For example with JQuery:

if ($.browser.msie && $.browser.version == 10) {
  $("html").addClass("ie10");
}

As @Spudley mentioned, the $_browser property is deprecated and already removed in the newer version of jQuery. Maybe it's better to check the browser for e certains feature you need. For example with Modernizr. This is also recommended in the JQuery documentation.

Upvotes: 5

Related Questions