Skip to content

Instantly share code, notes, and snippets.

@ataylorme
Created November 21, 2012 16:25
Show Gist options
  • Save ataylorme/4125826 to your computer and use it in GitHub Desktop.
Save ataylorme/4125826 to your computer and use it in GitHub Desktop.
PHP moderizr html tags for IE
<?php if( preg_match('/(?i)msie [1-6]/',$_SERVER['HTTP_USER_AGENT']) ){ ?>
<!-- the "no-js" class is for Modernizr. -->
<html class="ie ie6 no-js">
<?php } elseif( preg_match('/(?i)msie [7]/',$_SERVER['HTTP_USER_AGENT']) ){ //end if IE 6 ?>
<!-- the "no-js" class is for Modernizr. -->
<html class="ie ie7 no-js">
<?php } elseif( preg_match('/(?i)msie [8]/',$_SERVER['HTTP_USER_AGENT']) ){ //end if IE 7 ?>
<!-- the "no-js" class is for Modernizr. -->
<html class="ie ie8 no-js">
<?php } elseif( preg_match('/(?i)msie [9]/',$_SERVER['HTTP_USER_AGENT']) ){ //end if IE 8 ?>
<!-- the "no-js" class is for Modernizr. -->
<html class="ie ie9 no-js">
<?php } elseif( preg_match('/(?i)msie [10]/',$_SERVER['HTTP_USER_AGENT']) ){ //end if IE 9?>
<!-- the "no-js" class is for Modernizr. -->
<html class="no-js">
<?php } else{ //end if IE 10 ?>
<html lang="en-US">
<?php } //end if not IE ?>
@ataylorme
Copy link
Author

Dont forget to link to the Modernizr script in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment