Skip to main content

How to Conditionally Add Style Sheets for IE

Why use conditional stylesheets?

  • You got problems, they need fixin'
  • Keeps your code hack-free and valid
  • Keeps your main stylesheet clean
  • Perfectly acceptable technique, sanctioned by Microsoft
And remember, these conditional tags don't have to be used only for CSS. You could load JavaScript, or even use them down in the content of your site to display special IE-specific messages.

Target ALL VERSIONS of IE

<!--[if IE]>
        <link rel="stylesheet" type="text/css" href="all-ie-only.css" />
<![endif]-->

Target everything EXCEPT IE

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

Target IE 7 ONLY

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

Target IE 6 ONLY

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

Target IE 5 ONLY

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

Target IE 5.5 ONLY

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

Target IE 6 and LOWER

<!--[if lt IE 7]>
        <link rel="stylesheet" type="text/css" href="ie6-and-down.css" />
<![endif]-->

<!--[if lte IE 6]>
        <link rel="stylesheet" type="text/css" href="ie6-and-down.css" />
<![endif]-->

Target IE 7 and LOWER

<!--[if lt IE 8]>
        <link rel="stylesheet" type="text/css" href="ie7-and-down.css" />
<![endif]-->

<!--[if lte IE 7]>
        <link rel="stylesheet" type="text/css" href="ie7-and-down.css" />
<![endif]-->

Target IE 8 and LOWER

<!--[if lt IE 9]>
        <link rel="stylesheet" type="text/css" href="ie8-and-down.css" />
<![endif]-->

<!--[if lte IE 8]>
        <link rel="stylesheet" type="text/css" href="ie8-and-down.css" />
<![endif]-->

Target IE 6 and HIGHER

<!--[if gt IE 5.5]>
        <link rel="stylesheet" type="text/css" href="ie6-and-up.css" />
<![endif]-->

<!--[if gte IE 6]>
        <link rel="stylesheet" type="text/css" href="ie6-and-up.css" />
<![endif]-->

Target IE 7 and HIGHER

<!--[if gt IE 6]>
        <link rel="stylesheet" type="text/css" href="ie7-and-up.css" />
<![endif]-->

<!--[if gte IE 7]>
        <link rel="stylesheet" type="text/css" href="ie7-and-up.css" />
<![endif]-->

Target IE 8 and HIGHER

<!--[if gt IE 7]>
        <link rel="stylesheet" type="text/css" href="ie8-and-up.css" />
<![endif]-->

<!--[if gte IE 8]>
        <link rel="stylesheet" type="text/css" href="ie8-and-up.css" />
<![endif]-->

Comments

Popular posts from this blog

"Happy NAVRATRI UTASAV"

Durga, in Sanskrit means "She who is incomprehensible or difficult to reach." Goddess Durga is a form of Shakti worshiped for her gracious as well as terrifying aspect. Mother of the Universe, she represents the infinite power of the universe and is a symbol of a female dynamism. The manifestation of Goddess Durga is said to emerge from Her formless essence and the two are inseparable. She is also called by many other names, such as Parvati, Ambika, and Kali. In the form of Parvati, She is known as the divine spouse of Lord Shiva and is the mother of Her two sons, Ganesha and Karttikeya, and daughter Jyoti. Destroyer of demons, she is worshiped during an annual festival called Durga puja, Wishing you all Happy Durga Puja!!! Navratri Navratri, the festival of nights, lasts for 9 days with three days each devoted to worship of Ma Durga, the Goddess of Valor, Ma Lakshmi, the Goddess of Wealth and Ma Saraswati, the Goddess of Knowledge. During the nine days of Navrat...

What is Hackasaurus?

Hackasaurus is a suite of tools and curriculum that make it easy for anyone to learn webmaking through HTML and CSS. Hackasaurus is really about bringing HTML back to the non-technical audience.  X-Ray Goggles is primary tool for it. It makes  easy to see through Web pages and tinker with their individual parts. where participants can remix the web together and learn basic HTML and CSS.