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

+10

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

Rowsej

5 Answers

New Answer

+8

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.

+7

https://www.mediacollege.com/internet/html/detect/detect-ie.html

+2

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

+2

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.

-1

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