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

meotimdihia picture meotimdihia · Oct 18, 2010 · Viewed 125.7k times · Source

How can I 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 don't do it, it wont run. Help me with fixed IE, so that I can use above code in all IE versions.

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

Answer

Pekka picture Pekka · Oct 18, 2010

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.