简体   繁体   中英

IE Conditional Statement for ALL IE Not Working

The conditional statement for all versions of IE is not working properly. The styles to be applied to IE only are not taking effect in any version of IE. I have checked the mapping to ie.css and it is correct yet no luck.

<!DOCTYPE html>
        <head>
            <link rel="stylesheet" href="css/normalize.css">
            <link rel="stylesheet" href="css/main.css">
        <!--[if IE]>
            <link rel="stylesheet" href="css/ie.css">
        <![endif]-->
        </head>

As of IE 10, conditional comments are no longer supported.

From Microsoft: http://msdn.microsoft.com/en-us/library/ms537512.ASPX

Important As of Internet Explorer 10, conditional comments are no longer supported by standards mode. Use feature detection to provide effective fallback strategies for website features that aren't supported by the browser. For more info about standards mode, see Defining Document Compatibility

I found this CSS trick that seems to work on all versions of IE. Thank you everyone. :)

@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
 .selector { property:value; }
 }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM