asp.net - Why is Stylesheet loaded when Contional Comment states it should be ignored? -


I thought the conditional comments can allow the browser to ignore content if the condition is not met ?!

For example, I would like to include only one stylesheet if the IE6 browser is located in the following & lt; HEAD & gt; Element of the page

  & lt ;! - [If IE 6] & gt; & Lt; Link id = "IE6StyleSheet" rel = "stylesheet" type = "text / css" href = "~ / css / IE6.css" runat = "server" /> & Lt; [Endif] - & gt;  

or

  & lt ;! - [If IE 6] & gt; & Lt; Link rel = "stylesheet" type = "text / css" href = "../ css / IE6.css" /> & Lt; [Endif] - & gt;  

How are IE 7, IE8 and FF 3 loading all the stylesheets ?!

Note: Changing this situation [LTE IE 6] does not matter! :

Major Update

I'm a fool ... I just saw what I did wrong! For example I had given a little modified. The path of the CSS file under App_Themes! Of course, CSS was always loaded!

Try:

& lt;! - [If lte IE 6] & lt; link id = "IE6StyleSheet" rel = "stylesheet" type = "text / css" href = "../sss / IE6.css "/>
[Endif] ->

This will load the stylesheet only for IE6 or lower versions. Here is a test script that you can use, it will print the version of IE that you are using:

  

& lt ;! [If IE] & gt; This is Internet Explorer according to conditional comment & lt; br / & gt; & lt ;! [endif] - & gt; & lt ;! - [if IE5] & gt; according to conditional comment Internet Explorer 5
[Andif] ->
- [If IE 5.0] & gt; According to conditional commentary, this is Internet Explorer 5.0 & lt; Br / & gt; & Gt; [AndIf] - & gt; & Lt ;! - [If IE 5.5] & gt; According to conditional commentary, this is Internet Explorer 5.5. Br / & gt; & Lt; [Endif] - & gt; & Lt ;! - [If IE 6] & gt; According to the conditional commentary, this is Internet Explorer 6 & lt; Br / & gt; & Lt; [Endif] - & gt; & Lt ;! - [If IE 7] & gt; According to conditional commentary, this is Internet Explorer 7. Br / & gt; & Lt; [Endif] - & gt; & Lt ;! - [gte IE 5] & gt; According to the conditional commentary, it is Internet Explorer 5 and above & lt; Br / & gt; & Lt; [Endif] - & gt; & Lt ;! - [If LT IE 6] & gt; According to the conditional comment, it is less than Internet Explorer 6 & lt; Br / & gt; & Lt; [Endif] - & gt; & Lt ;! - [If lte IE 5.5] & gt; According to the conditional comment, it is equivalent to Internet Explorer 5.5 or lower & lt; Br / & gt; & Lt; [Endif] - & gt; & Lt ;! - [gt gt 6] & gt; According to conditional comment it is more than Internet Explorer 6 & lt; Br / & gt; & Lt; [Endif] - & gt; & Lt; / P & gt;

You will not be able to see any text in Firefox with this test code.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -