HTML Methods

Microsoft Internet Explorer Conditional Comments

IE supports a conditional comment syntax for hiding content from non-IE browsers, or specific versions of IE browsers. This only works for the Windows version of Internet Explorer (the Trident layout engine).

Example 1.4.1. IE Conditional Comments

<!--[if IE]><link rel="stylesheet" type="text/css" href="iefixup.css"/><![endif]-->
<!--[if lt IE 7]> ... IE 6 and below content ... <![endif]-->
<!--[if gt IE 6]> ... IE 7 and above content ... <![endif]-->
<![if !IE]> ... non-IE content (invalid markup--do not use) ... <![endif]>

data: URIs

Internet Explorer (as of version 7) still does not support data URIs. This provides a method to hide content, such as modern CSS, from IE.

Example 1.4.1. Importing a stylesheet for non-IE browsers

A intermediate stylesheet that consists of a single @import statement is encoded as a data URI. Because data: URIs do not provide a base URI, a full URI to the stylesheet must be provided.

<link rel="stylesheet" type="text/css" href="data:text/css,%40import%20url(http%3A%2F%2Fexample.net%2Fadvanced.css)%3B"/>