Andrea Posted May 14, 2014 Report Posted May 14, 2014 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? Quote
administrator Posted May 14, 2014 Report Posted May 14, 2014 conditional comments allow you to hide code from all other browsers except for IE. In this case: gte IE 7 Means: if greater than or equal to IE7 ... display this tag. Since the code is in comments: <!--> .. The other browsers just ignore it. Stef Quote
administrator Posted May 14, 2014 Report Posted May 14, 2014 Holy crap ... here's an old video I did on this in 2006: http://www.killersites.com/videoTutorials/Tutorial_WebDesign2/ie_conditional_comments.html Here a blog post related to it: http://www.killersites.com/blog/2006/ie-conditional-comments-video/ Stef Quote
administrator Posted May 14, 2014 Report Posted May 14, 2014 Oops .. disregard my posts! ... I should have read your whole question! At first glance, it looks like messed up code. Did you run it ... does it display ok? Stef Quote
Andrea Posted May 14, 2014 Author Report Posted May 14, 2014 Just finished the video - 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]--> Quote
Andrea Posted May 14, 2014 Author Report Posted May 14, 2014 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 Quote
newseed Posted May 14, 2014 Report Posted May 14, 2014 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. Quote
Andrea Posted May 14, 2014 Author Report Posted May 14, 2014 Thanks Eddie, no need to waste time. Still makes no sense to me, so. Quote
newseed Posted May 14, 2014 Report Posted May 14, 2014 No biggie but just in case you are curious, here's the link: http://www.cssplay.co.uk/menus/flyout2.html Quote
Recommended Posts
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.