Page is a not externally linkable
- Code, Content, and Presentation
-- CSS
---- Microsoft Conditional Comments


iamlost - 1:34 am on Jan 27, 2007 (gmt 0)


Thanks SuzyUK and coopster. Between the two of you my lightbulb went off with a pop and a flash - may need replacement :-)

<! is the markup delimiter with > ending/closing the markup.
-- is the comment delimiter with with --> ending/closing the comment.
(This I had not properly understood until now)

Thus <!DocType...> specifies the document syntax markup.

Thus <!ENTITY % head.misc "SCRIPT¦STYLE¦META¦LINK¦OBJECT" -- repeatable head elements --> within a DocType Definition breaks down as:

<!ENTITY % head.misc "SCRIPT¦STYLE¦META¦LINK¦OBJECT"
is the actual markup and
-- repeatable head elements
serves as an inline comment describing the purpose of the markup and
-->
serves to close both the markup and the comment.

..........

Therefore given:


<![if IE 7]>
<h1>You are using Internet Explorer 7</h1>
<![endif]>

both <![if IE 7]> and <![endif]> are read by non-IE5+ (the derogatory downlevel) browsers as unknown/meaningless markup to be ignored but the <h1>You are using Internet Explorer 7</h1> is understood and displayed appropriately.

IE7 reads it as referring to itself (see following re proprietary if statement) and will display the <h1> while IE6(and lower) would not. If written <![if !IE 7]> (note the ! before the IE) then IE6(and lower) would display the <h1>, only the designated IE7 would not.

And therefore:


<!--[if IE]>
<h1>You are using Internet Explorer</h1>
<![endif]-->

Being recognised by all but IE5+ browsers as a properly constituted comment beginning with <!-- and ending with --> it is appropriately not rendered.

The IE5+ browsers happily read the comment as containing a proprietary markup command ([if IE]) and render the <h1> as directed.


Thread source:: http://www.webmasterworld.com/css/3232700.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com