Conditional Comments for IE

IE Conditional Comments
Conditional comments only work in IE, and are thus excellently suited to give special instructions meant only for IE. They are supported from IE 5 up until IE9.
They have become a commonly used method of latching extra CSS to a document to plaster over holes in these browsers’ display capabilities. So, for example, you might add something like this inside your head element.

Older IE versions need some extra CSS in order to show your pages properly. Conditional comments are the best way to add this CSS, since the system is explicitly designed for this use case.

Conditional comments can be placed at any point in the document at which normal comments can be located. As such, you can’t place them in external CSS files, or in between tags. However, they can be used to link to specific files, or to provide specific HTML (or CSS) content for the IE versions specified within the conditional statement.

Why to use conditional statements or Conditional Comments ?

Fixing IE bugs is always a headache for the developers.Conditional comments can be used to fix the bugs in IE, without affecting other browsers. Conditional comments will work only in IE and so we can give special instructions which is meant only for IE 5 onward.

<!–[if IE]>
background: #fff;

Their basic structure of conditional comment is the same as an HTML comment (). Therefore all other browsers will see them as normal comments and will ignore them entirely. IE, though, has been programmed to recognize the special

label, , , , , , , , , , , , ,

About the author