HTML: Conditional Else Comment
IE browsers support Conditional Comments, but the syntax only supports IF statements – there is no ELSE.
Stu Nicholls and the JavaScript Kit to the rescue; the following simulates an else statement:
<html> <head><title>Choose a browser...</title></head> <body> <p>You chose <![if ! IE]> wisely <![endif]><!--[if IE]> poorly <![endif]--> ...</p> </body> </html>
Copy to a text file, save as html and run in IE and Firefox/Chrome/Safari/Opera…
Labels: design, experiment, howto
2 Comments:
interesting snippit. where'd you come across this one?
By Jesse FitzGibbon, at Thursday, February 26, 2009 8:22:00 AM
Well, the final compact format was of my own creation, but I got guidance along the way from Stu and the Javascript Kit page (both linked in the post).
By Oskar Austegard, at Thursday, February 26, 2009 9:23:00 AM
Post a Comment
<< Home