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?
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/
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.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now