0

I'm trying to apply the technique recommended here for IE detection in jQuery:

https://stackoverflow.com/a/3165521/1093087

What I'm unclear about is how to set the html tag for non-IE browsers.

This is what I currently have in my template:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>

Is this what I should replace it with:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!--[if lt IE 8><html class="lt-ie8"><![endif]-->
<!--[if IE 8]><html class="ie8"><![endif]-->
<!--[if gt IE 8]><!--><html><!--<![endif]-->
  <head>

Is IE going to be confused by two html tags if I do it that way?

Community
  • 1
  • 1
klenwell
  • 6,978
  • 4
  • 45
  • 84
  • If you want to, sure. "Should" depends on your needs. [HTML5 Boilerplate](http://html5boilerplate.com) [does it slightly differently now.](https://github.com/h5bp/html5-boilerplate/blob/master/index.html) – Blazemonger Feb 06 '13 at 17:44

1 Answers1

3

Try this:

<!doctype html>
<!--[if lt IE 7 ]> <html class="ie6" lang="en-US" 
                        xmlns="http://www.w3.org/1999/xhtml"
                        > <![endif]-->
<!--[if IE 7 ]>    <html class="ie7" lang="en-US" 
                        xmlns="http://www.w3.org/1999/xhtml"
                        > <![endif]-->
<!--[if IE 8 ]>    <html class="ie8" lang="en-US" 
                        xmlns="http://www.w3.org/1999/xhtml"
                        > <![endif]-->
<!--[if IE 9 ]>    <html class="ie9" lang="en-US" 
                        xmlns="http://www.w3.org/1999/xhtml"
                        > <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!-->
<html xmlns="http://www.w3.org/1999/xhtml">
<!--<![endif]-->

You will have CSS for each instance to customize stuff.

spooky
  • 1,620
  • 1
  • 13
  • 15