You are here: Re: Conditional Comment, it works, but why? « HTML « IT news, forums, messages
Re: Conditional Comment, it works, but why?

Posted by Jonathan N. Little on 10/24/06 17:35

patrick j wrote:
> Hi
>
> I've been testing out the "Conditional Comment" for IE. This is because
> for my web-site I want to have two style sheets, one for IE 6 and one
> for other browsers. Thus I hope to have my web-site as I want it for
> "other browsers" but still have it presentable in IE.
>
> I understand why the conditional comment works, despite the subject
> header for this posting. What I don't understand is why IE "ignores"
> the link to the CSS that precedes the conditional comment link.
>
> Now that I've got you transfixed with interest I will give you the URL
> to my conditional comment test web-page:
>
> <http://www.patrickjames.me.uk/cond_com_test.html>
>
> Fortunately it is at least a very positive message.
>
> Viewed with IE/Win 6 or 5 the background is maroon, the text is white.
> Viewed with any other browser then the background is white the text is
> maroon.
>
> I have the "Link" tags in the HTML header section arranged like this:
>
> <link href="cond_com_test.css" rel="stylesheet" type="text/css">
> <!--[if lt IE 7]>
> <link href="cond_com_test_ie.css" rel="stylesheet" type="text/css" >
> <![endif]-->
>
> As you can see the link to the "other browser" style-sheet comes before
> the one within the conditional comment for IE/Win 5/6.
>
> I understand that IE makes a decision on the basis of the conditional
> comment, it's programmed to recognise it, but what I don't understand
> is how it knows to ignore the link to the style-sheet for other
> browsers which comes first?

It doesn't, it applies cond_com_test.css first then redefines by
applying cond_com_test_ie.css. You would ge a very different result if
your markup was:

<!--[if lt IE 7]>
<link href="cond_com_test_ie.css" rel="stylesheet" type="text/css" >
<![endif]-->

<link href="cond_com_test.css" rel="stylesheet" type="text/css">


--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация