Mar 31, 2009
Browserswitch — zwischen IE und FF unterscheiden
Categories: web-development
Written By: viktor-dite
Die Lösung heißt: conditional comments
Normal comment: <!-- Comment text -->
Conditional comment: <!--[If expression]> HTML <![endif]-->
Für den einfachsten Switch bedeutet dies:
<!--[If IE]> HTML <![endif]-->
Hier wird jeder IE (ab v5) den eingeklammerten HTML code ausführen
Die umgekehrte Richtung geht leider nur mit einem nicht XHTML validen code, nämlich:
<!--[if !IE]>
Das Ganze geht auch komplexer:
- ! (negation)
Use the negation to select all versions except the one specified, e.g.
[If !IE 6]will select IE 5, 5.5 and 7. - lt (less than)
Select any versions less than the one specified, e.g.[If lt IE 6]will select IE 5 and 5.5. - lte (less than or equal)
e.g.[If lte IE 6]will select IE 5, 5.5 and 6. - gt (greater than)
Select any versions greater than the one specified, e.g.[If gt IE 6]will select IE 7 (and any later versions that may appear). - gte (greater than or equal)
e.g.[If gte IE 6]will select IE 6 and 7 (and later).
Für weitere Informationen [Quelle]
Tags:Browser, css, firefox, IE, IE6, Internet Explorer, php, switch, Weiche

