PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

Conditional comments displayed on page

 
 
Chris Beall
Guest
Posts: n/a
 
      23rd Nov 2009
URL: http://ulsterliteracy.org/sandbox/

Conditional comments are used to expose unique HTML for IE 7 and below.
As expected, non-IE browsers correctly ignore the conditional comments.
IE6, IE7, and IE8 all DISPLAY the conditional comments on the page (and
also all select the code bracketed by [if IE lte 7]).

I've looked at this over and over and can't see what is wrong.

I need another pair of eyes to look at the source and tell me where I've
gone wrong. My reference for the coding was
http://msdn.microsoft.com/en-us/library/ms537512(VS.85).aspx

Chris Beall
 
Reply With Quote
 
 
 
 
PA Bear [MS MVP]
Guest
Posts: n/a
 
      23rd Nov 2009
See
http://validator.w3.org/check?uri=ht...Inline&group=0

Chris Beall wrote:
> URL: http://ulsterliteracy.org/sandbox/
>
> Conditional comments are used to expose unique HTML for IE 7 and below.
> As expected, non-IE browsers correctly ignore the conditional comments.
> IE6, IE7, and IE8 all DISPLAY the conditional comments on the page (and
> also all select the code bracketed by [if IE lte 7]).
>
> I've looked at this over and over and can't see what is wrong.
>
> I need another pair of eyes to look at the source and tell me where I've
> gone wrong. My reference for the coding was
> http://msdn.microsoft.com/en-us/library/ms537512(VS.85).aspx
>
> Chris Beall


 
Reply With Quote
 
Chris Beall
Guest
Posts: n/a
 
      24th Nov 2009
Um, yes I do see it. 8 errors, one for each conditional statement.
Actually I saw it before posting here. The validator doesn't like the
conditional comment syntax. I can't fix that.

But looking at it again (after a good dinner), I notice that the correct
syntax is:
<![if gt IE 7]>
whereas I consistently tried to make it a comparison between IE and the
version number:
<![if IE gt 7]>
which is wrong. Apparently when IE hits this, it detects the bad syntax
and, unable to act upon the condition, displays it instead.

So I fixed that and now it works fine.

Oh, and still gets 8 validation errors...

Cheers,
Chris Beall

PA Bear [MS MVP] wrote:
> See
> http://validator.w3.org/check?uri=ht...Inline&group=0
>
>
> Chris Beall wrote:
>> URL: http://ulsterliteracy.org/sandbox/
>>
>> Conditional comments are used to expose unique HTML for IE 7 and below.
>> As expected, non-IE browsers correctly ignore the conditional comments.
>> IE6, IE7, and IE8 all DISPLAY the conditional comments on the page (and
>> also all select the code bracketed by [if IE lte 7]).
>>
>> I've looked at this over and over and can't see what is wrong.
>>
>> I need another pair of eyes to look at the source and tell me where I've
>> gone wrong. My reference for the coding was
>> http://msdn.microsoft.com/en-us/library/ms537512(VS.85).aspx
>>
>> Chris Beall

>

 
Reply With Quote
 
rob^_^
Guest
Posts: n/a
 
      25th Nov 2009
Hi Chris,

Change this

<!--[if gt IE 7]><!-->
<div class="header">
<div class="logo">
<!--<![endif]-->
to
<!--[if gt IE 7]>
<div class="header">
<div class="logo">
<![endif]-->


Comment: The IE Conditional comments don't like nested comment tags. Usually
you use conditional comments in the head section to call in a different
stylesheet.



"Chris Beall" <(E-Mail Removed)> wrote in message
news:hef30j$kgt$(E-Mail Removed)...
> URL: http://ulsterliteracy.org/sandbox/
>
> Conditional comments are used to expose unique HTML for IE 7 and below.
> As expected, non-IE browsers correctly ignore the conditional comments.
> IE6, IE7, and IE8 all DISPLAY the conditional comments on the page (and
> also all select the code bracketed by [if IE lte 7]).
>
> I've looked at this over and over and can't see what is wrong.
>
> I need another pair of eyes to look at the source and tell me where I've
> gone wrong. My reference for the coding was
> http://msdn.microsoft.com/en-us/library/ms537512(VS.85).aspx
>
> Chris Beall
>

 
Reply With Quote
 
Chris Beall
Guest
Posts: n/a
 
      25th Nov 2009
The bracketed code is intended for IE8 (and above) and all non-IE
browsers. If I did what you suggest, non-IE browsers would see the
whole thing as a comment.

The syntax I used validates and seems to work everywhere I've tested.

Again, the original problem was the syntax WITHIN the CC; I had 'if IE
gt 7'.

Chris Beall

rob^_^ wrote:
> Hi Chris,
>
> Change this
>
> <!--[if gt IE 7]><!-->
> <div class="header">
> <div class="logo">
> <!--<![endif]-->
> to
> <!--[if gt IE 7]>
> <div class="header">
> <div class="logo">
> <![endif]-->
>
>
> Comment: The IE Conditional comments don't like nested comment tags.
> Usually you use conditional comments in the head section to call in a
> different stylesheet.
>
>
>
> "Chris Beall" <(E-Mail Removed)> wrote in message
> news:hef30j$kgt$(E-Mail Removed)...
>> URL: http://ulsterliteracy.org/sandbox/
>>
>> Conditional comments are used to expose unique HTML for IE 7 and below.
>> As expected, non-IE browsers correctly ignore the conditional comments.
>> IE6, IE7, and IE8 all DISPLAY the conditional comments on the page
>> (and also all select the code bracketed by [if IE lte 7]).
>>
>> I've looked at this over and over and can't see what is wrong.
>>
>> I need another pair of eyes to look at the source and tell me where
>> I've gone wrong. My reference for the coding was
>> http://msdn.microsoft.com/en-us/library/ms537512(VS.85).aspx
>>
>> Chris Beall
>>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comments Without Indicators; Displayed when Cells are Clicked katzy Microsoft Excel Misc 2 21st Apr 2008 09:47 PM
Missing comments displayed as warnings in VS digitalshehan@gmail.com Microsoft C# .NET 1 29th Aug 2006 03:34 PM
Comments being displayed twice in My Network Places =?Utf-8?B?Sm9obiBOaWNob2w=?= Windows XP General 0 25th Aug 2004 11:29 PM
Comments being displayed twice in My Network Places =?Utf-8?B?Sm9obiBOaWNob2w=?= Windows XP Networking 0 25th Aug 2004 11:29 PM
Printing Comments as displayed on the page. Cindy Kiner Microsoft Excel Misc 2 19th Nov 2003 07:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:31 AM.