Jump to content
Killersites Forums

Conditional Comments - What Is This?


Andrea
 Share

Recommended Posts

This code is part of a navigation list I'm trying to work on (somebody else's work, very complex site)

<!--[if gte IE 7]><!--></a><!--<![endif]-->

I get the first part and the end - but what in the world is this:

<!--></a>

That is, the closing 'a' would be if the browser is IE8 or higher, then we want to close the a tag.

Why would I only want to close a link in IE8 or higher? Why not in FX, Chrome, or IE7?

 

And what could this

<!-->

possible be good for?

 

And what about the <!-- before the actual end if part? Does that have any kind of purpose, or did whoever wrote this thing simply mess up?

Link to comment
Share on other sites

Just finished the video :D  - you didn't talk about the mystery code, but I could confirm that I understand IE Conditional Comments.

 

Knowing where the code comes from, my first guess is that it's somebody's mess, but I didn't want to point out a mistake to find out it's actually just fancy coding.

 

It seems to work ok in IE11, but it's a huge site, and I'm not even sure if I'm looking at the right page.

 

But to sum it up - can you confirm these 2 points:

 

There is no reason to have a link close ONLY in IE7 and greater?

 

There is absolutely no point in the red stuff:

<!--[if gte IE 7]><!--></a><!--<![endif]-->

Link to comment
Share on other sites

I was too impatient to wait for a reply here, so I sent an email to our website people, saying this looks like a mistake to me, but if it's something new, I'd love an explanation, and this is the response I got:

 

I can’t explain because I didn’t set it up. Our designer researched CSS flyouts, and that’s what she found that worked with our website.

 

I just copy and tweak to fit whatever site I’m working on.

 

So there you have it, folks :raised:

Link to comment
Share on other sites

If my memory serves me correctly, I think that code came from Stu at cssplay.com where flyouts didn't work for IE7 or earlier unless that comment was in there. I know it's weird but it did work and without it just broke.  Of course that flyout example is long gone but I bet if I dug through all my old codes I could find it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...