+ 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.

24th Oct 2018, 8:48 AM
Rowsej
Rowsej - avatar
5 Réponses
+ 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.
24th Oct 2018, 9:06 AM
Taste
Taste - avatar
+ 2
well there are some compatibility issues in internet explorer 8, regrding HTML 5, to tackle them, this code is used
25th Oct 2018, 5:06 AM
Kaushik Dey
Kaushik Dey - avatar
+ 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.
26th Oct 2018, 6:04 AM
Andrew Watts
Andrew Watts - avatar
- 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🤷‍♂️
27th Oct 2019, 1:35 PM
Andrew Johnson
Andrew Johnson - avatar