Prev | Current Page 447 | Next

Craig Grannell

"The Essential Guide to CSS and HTML Web Design"

An example of a
conditional comment is shown in the following code block:

Anything placed inside this comment will only be shown in Internet Explorer 6??”all other
browsers ignore the content. This is most useful for adding IE-specific style sheets to a web
page, within which you can place overrides. For example, rather than using the box model
hack shown earlier in the chapter, you would have a clean style sheet, and then override
specific values in a separate style sheet for Internet Explorer 5.x, attached within a conditional
comment.
Generally, problems with Internet Explorer fall into the following camps: rare issues with
Internet Explorer 7, problems that affect versions 6 and below, and problems that specifically
affect version 5.x. With that in mind, I mostly add three IE-specific style sheets to my
web pages, with the newest release at the top. Conditional comments are generally added
after the ???default,??? or clean, style sheets (which in this case are the main style sheet
added using a style element, and a print style sheet added using a link element).

?? type="text/css" media="print" />
THE ESSENTIAL GUIDE TO CSS AND HTML WEB DESIGN
356