HTML if statements | SoloLearn: Learn to code for FREE!


HTML if statements

I’ve seen a few codes, that in the head of the document, use some code like this: <!—[if lt IE8]>some code...<![endif]—> What does that mean? And HTML is a markup language, not scripting, so how is it HTML? I would like to know as much as I can about it. Thanks in advance.

10/24/2018 8:48:04 AM


5 Answers

New Answer


as far as i know its just microsoft thing, and IE only (cmiiw). that thing called conditional comments. since its a comment most of browser would simply ignore it, but for IE <= 9 it's a feature (its deleted in IE10) why its exist, IE is a hell for css. what work here doesnt mean it'll work in IE or specific version of IE microsoft seems to know this then add this feature.



well there are some compatibility issues in internet explorer 8, regrding HTML 5, to tackle them, this code is used


I think it's because some of us first write their codes in their pc's using different software. Let's take for instance when I developed a Web document in front page 2002 there's always <!-unicord........> at the head of the the document then we paste them here 19 That's an Internet Explorer conditional comment , which reads out "if using Internet Explorer less than version 9 (IE8 and lower), do this...". When the conditional passes, HTML5Shiv is run in the browser.


That code shows it is a comment. Also, IE8 means Internet Explorer 8, but there is no conditional statements in HTML to my knowledge🤷‍♂️