Search code examples
htmlinternet-explorermodernizrhtml5boilerplate

IE Conditionals on html 5 boilerplate or initializr don't work with Modernizr?


The way IE Conditionals work on HTML5Boilerplate / initializr doesn't seem to work with Modernizr.

What I mean is that the <html> element doesn't contain the correct class for ie, if for example lt-ie9:

<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->

On IE < 9 for example, I get:

<html class=" js no-flexbox no-canvas...">

So, as you can tell, there's no way I can target ie<9 by using the lt-ie9 class.

I've been noticing this for quite a while and I usually end up having to use javascript to add the class dynamically.

So, I'd like to know if this is correct. Anyone else experienced this?

I'm using IE10 Dev tool, on IE8 mode, so not sure if conditionals are supported

Thanks for looking!


Solution

  • Conditional comments are not support in IE 10.

    Use the actual browser - you can download free virtual machines from modern.ie