Skip to content Skip to sidebar Skip to footer

Using Two Conditional Css If Statements Uses Neither Style Sheet

At my wit's end here. Trying to implement two different style sheets, one for IE and one for when it's not IE. In every example I've ever seen this is exactly the way you're suppos

Solution 1:

For the !IE conditional comment, the correct format is <!--[IF !IE]>--> ... <!-- <![endif]-->, because non-IE browsers do not have a special treatment for the conditional comments.

<!--[if !IE]> --><link rel='stylesheet' type='text/css' href='/login/css/correctlogin.css'/><!-- <![endif]-->
<!--[if IE]><link rel='stylesheet' type='text/css' href='/login/css/ielogin.css'/><![endif]-->

See also: http://www.quirksmode.org/css/condcom.html
PS. Conditional comments are not supported in IE10 any more.


Solution 2:

The if not IE statement is redundant. All you need is an if IE statement.

<link rel='stylesheet' type='text/css' href='/login/css/correctlogin.css'/>
<!--[if IE]>
<link rel='stylesheet' type='text/css' href='/login/css/ielogin.css'/>
<![endif]-->

This tells every browser to use correctlogin.css and if the browser is IE, THEN also use ielogin.css


Post a Comment for "Using Two Conditional Css If Statements Uses Neither Style Sheet"