DO YOU NEED A CONTENT WRITER FOR YOUR BUSINESS?

Your One-Stop Solution for All Content Needs! Click here for more!
Css

Create an IE Only Stylesheet

Share

IE provides comment tags which is supported most of the IE version to target specific versions for creating IE Only Stylesheet.

How’s your experience with IE? There is a 99% chance that you’ve had a hair-pulling experience with IE.

We use conditional stylesheets when we face any problems and want to keep our code very clean.

Internet Explorer 9 and lower: You can use conditional comments to load an IE-specific stylesheet for any version that you wanted to target specifically.

Here are meaning of syntax:

!IE = not IE
gt = greater than
gte = greater than or equal
lt = less than
lte = less than or equal

For all versions of IE

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

Everything except IE

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

Target IE 8 only

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

Target IE 7 only

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

Target IE 6.5 only

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

Target IE 8 and lower

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

or,

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

Target IE 8 and higher

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

or,

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

However, in the beginning of IE version 10, conditional comments are no longer supported in IE.

Internet Explorer 10 & 11: You can create a media query using -ms-high-contrast by which you can place your IE 10 and 11 specific CSS styles.

Because -ms-high-contrast is Microsoft-specific which is only available in IE 10+ and this will only be parsed in Internet Explorer 10 and greater.

@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
/* IE10+ CSS styles */}
CSS Designer

View Comments

Recent Posts

How Does Shade and Bad Weather Impact Solar Panels?

Solar panels work by converting the solar energy received from the sun into usable electric…

3 days ago

Websites Design Companies: How They Help Businesses Succeed Online

In today’s digital-first economy, your website is often the first impression your business makes. Whether…

5 days ago

Best Social Media Agencies in Dubai – 2025 Guide

Dubai’s digital landscape is highly competitive, making it essential for businesses to work with the…

7 days ago

Tips on Hiring Plumbing Contractors Company

Are you planning to hire plumbers for repairing water lines, checking the level of your…

1 week ago

Common Household Plumbing Problems That Sydney Residents Endure

Despite being one of the most expensive real estate markets in the world, Australians still…

1 week ago

The Best Online Grammar Checkers

Below are the tools that actually help instead of confusing you with long explanations or…

1 week ago