Johnny2 Posted January 16, 2013 Report Posted January 16, 2013 I'm a bit confused about the "commented-out" code that I'm learning about in the Killersites tutorials. For instance: <!--[if lt IE 9]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> I think this code is supposed to allow earlier versions of Internet Explorer to display things correctly. My questions: Are we supposed to leave it commented out??? If so, why? If so, how does the browser react to it if the browser thinks it is only a comment??? If we are NOT supposed to leave it commented out, why was it commented out in the lessons? Quote
grabenair Posted January 17, 2013 Report Posted January 17, 2013 This is called a conditional comment. What you do is build your site and test with firefox or chrome and then test in IE back to IE 7 should be fine. Then you see what is not working right then rewrite your css in a style sheet for IE. Make sure to link the conditional comment sheet below your main rules in the head. Here is a good article on this http://www.impressivewebs.com/conditional-comments/ Quote
newseed Posted January 17, 2013 Report Posted January 17, 2013 I'm a bit confused about the "commented-out" code that I'm learning about in the Killersites tutorials. For instance: <!--[if lt IE 9]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> I think this code is supposed to allow earlier versions of Internet Explorer to display things correctly. My questions: Are we supposed to leave it commented out??? If so, why? If so, how does the browser react to it if the browser thinks it is only a comment??? If we are NOT supposed to leave it commented out, why was it commented out in the lessons? Only IE can understand this type of conditional comment and so it knows to execute it if the conditional statement is done correctly just as you have shown in your post. To all other browsers it just a commented out code. 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.