FIX CSS <!--[if lt IE 8]> in IE

2019-02-02 02:53发布

How to i can use this

    <!--[if lt IE 8]>
    <style type='text/css'>
  #header ul#h-menu li a{font-weight:normal!important}
    </style>
    <![endif]-->

if i remove <!--[if lt IE 8]><![endif]--> Above code 'll run good in IE 8 but if i dont it dont run. Help me with fixed IE, if i want in above code in all IE version,.

i want code #header ul#h-menu li a{font-weight:normal!important} run only in IE

8条回答
不美不萌又怎样
2楼-- · 2019-02-02 03:36

[if lt IE 8] means "if lower than IE8" - and thats why it isn't working in IE8.

wahat you want is [if lte IE 8] which means "if lower than or equal IE8".

查看更多
叛逆
3楼-- · 2019-02-02 03:37

Use <!-- [if lt IE 9] > exact this code for IE9.The spaces are very Important.

查看更多
地球回转人心会变
4楼-- · 2019-02-02 03:39

Also, the comment tag

<comment></comment> 

is only supported in IE 8 and below, so if that's exactly what you're trying to target, you could wrap them in comment tag. They're the same as

<!--[if lte IE 8]><![endif]-->

In which lte means "less than or equal to".

See: Conditional Comments.

查看更多
女痞
5楼-- · 2019-02-02 03:44

How about

<!--[if IE]>
...
<![endif]-->

You can read here about conditional comments.

查看更多
ら.Afraid
6楼-- · 2019-02-02 03:45
I found cascading it works great for multibrowser detection.

This code was used to change a fade to show/hide in ie 8 7 6.

$(document).ready(function(){
    if(jQuery.browser.msie && jQuery.browser.version.substring(0, 1) == 8.0)
         { 
             $(".glow").hide();
            $('#shop').hover(function() {
        $(".glow").show();
    }, function() {
        $(".glow").hide();
    });
         }
         else
         { if(jQuery.browser.msie && jQuery.browser.version.substring(0, 1) == 7.0)
         { 
             $(".glow").hide();
            $('#shop').hover(function() {
        $(".glow").show();
    }, function() {
        $(".glow").hide();
    });
         }
         else
         {if(jQuery.browser.msie && jQuery.browser.version.substring(0, 1) == 6.0)
         { 
             $(".glow").hide();
            $('#shop').hover(function() {
        $(".glow").show();
    }, function() {
        $(".glow").hide();
    });
         }
         else
         { $('#shop').hover(function() {
        $(".glow").stop(true).fadeTo("400ms", 1);
    }, function() {
        $(".glow").stop(true).fadeTo("400ms", 0.2);});
         }
         }
         }
       });
查看更多
对你真心纯属浪费
7楼-- · 2019-02-02 03:50

If you want this to work in IE 8 and below, use

<!--[if lte IE 8]>

lte meaning "Less than or equal".

For more on conditional comments, see e.g. the quirksmode.org page.

查看更多
登录 后发表回答