ie10 stylesheet

2020-06-16 05:42发布

问题:

I'm trying to link to IE10 with an external style sheet but its not working properly. whats happening is IE10 is using the same style sheet as the other browsers. i have attached different stylesheets for IE 9 and 8 and those are fine. i even tried to have a style sheet for the other browsers but IE 10 seems to think its one of the other browsers.

<!--[if lt IE 10]>
<link rel="stylesheet" type="text/css" href="ie10.css" />
<![endif]-->

回答1:

[if gt IE 9] for 'greather than' 9

explained here : http://msdn.microsoft.com/en-us/library/ms537512%28v=vs.85%29.aspx

BUT you should read carefully over the net ( http://www.sitepoint.com/microsoft-drop-ie10-conditional-comments/) ... ie10 dropped conditional comments.

Same topic here How do I target only Internet Explorer 10 for certain situations like Internet Explorer-specific CSS or Internet Explorer-specific JavaScript code?

no more support for conditional comments

And to answer to : link to IE10 -->

Perhaps you can try some jQuery like this (nota: This property was removed in jQuery 1.9 and is available only through the jQuery.migrate plugin.):

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

Or you can try the @media -ms-high-contrast Hack like this:

@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {  
   /* IE10-specific styles go here */  
}

or you can try the @media Zero Hack

@media screen and (min-width:0\0) {  
    /* IE9 and IE10 rule sets go here */  
}


回答2:

You probably want lte (less than or equal) or exact match instead of lt (less than).



回答3:

Just finishing up on an html email (responsive). And from what I've been reading so far the solution to IE 10 isn't having an external, but using:

@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { 

}

as part of the main css.



回答4:

If you're adding this to a wp theme you'll have to link it properly. Ex:

<!--[if lt IE 10]><link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/ie10.css" /><![endif]-->