开发者

Conditional statement not loading style sheets

This is one of those rare occasions that I have had to use conditional statements in order to correct problems with IE. I am using IE8 and need to have a stylesheet for IE and one for FF and other browsers. I cannot see why this statement would not load the correct style sheet? I have put a simple message in a paragraph but neither message is being output. Can someone tell me how I would go about debugging this as my knowledge of conditional statements is zilch. I have put the statement in the head part of the html and all paths are correct. Thanks

<!--[i开发者_JAVA技巧f !IE]>

<link href="/sample/admin/css/menu/css/layout.css" rel="stylesheet" type="text/css" media="screen">
<p style="color: blue; font-size:18px;">You are NOT using IE</p>

<![endif]-->

<!--[if IE]>

<link href="/sample/admin/css/menu/css/ie_layout.css" rel="stylesheet" type="text/css" media="screen">
<p style="color: blue; font-size:18px;">You are using IE</p>

<![endif]-->


just use the second conditional:

<!--[if IE]>
<link href="/sample/admin/css/menu/css/ie_layout.css" rel="stylesheet" type="text/css" media="screen">
<![endif]-->

The first one isn't necessary.

To check if it is behing called, change (for example) the body, adding some background color; you should see it straight away. Also make sure the file path is correct.

Also, your p is behing inputted before the <body>? (I mean, you are adding the CSS at the <head>, correct?)

P.S. note that these type of conditional statements only work when using IE, that's why the first statement is unnecessary and won't output the message when viewed on a browser different than IE.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜