Take it you pulled this from HTML5 Boilerplate's latest update. Reading
through Paul Irish's comments on the update (
http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/)
the change makes sense.
On Thu, Oct 28, 2010 at 7:21 AM, Foskett, Mike mike.fosk...@uk.tesco.comwrote:
Hi All,
I was wondering if you had a little time to comment on the following
technique?
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
!--[if IE]
![if gt IE 8]html lang=en-gb class=gtIE8 xml:lang=en-gb xmlns=
http://www.w3.org/1999/xhtml;![endif]
![if IE 8]html lang=en-gb class=IE8 xml:lang=en-gb xmlns=
http://www.w3.org/1999/xhtml;![endif]
![if IE 7]html lang=en-gb class=IE7 xml:lang=en-gb xmlns=
http://www.w3.org/1999/xhtml;![endif]
![if IE 6]html lang=en-gb class=IE6 xml:lang=en-gb xmlns=
http://www.w3.org/1999/xhtml;![endif]
![endif]--
!--[if !IE]!--html lang=en-gb class=xIE xml:lang=en-gb xmlns=
http://www.w3.org/1999/xhtml;!--![endif]--
script
type=text/javascript/*![CDATA[*/document.documentElement.className+=
hasJS;/*]]*//script
... yada ...
style type=text/css
body {background:#ccc; color:#000}
.IE8 body {background:#fcc;}
.IE7 body {background:#cfc;}
.IE6 body {background:#ccf;}
.xIE body {background:#fff;}
/style
... yada ...
Not thoroughly tested I admit but it appears reasonable.
The only failure I can see is detecting IEv6 and JS on because:
.IE6.hasJS {background:#f000}
will not work as IE 6 cannot concatenate class names.
What do you think?
Regards,
Mike Foskett
http://websemantics.co.uk/
--
This is a confidential email. Tesco may monitor and record all emails. The
views expressed in this email are those of the sender and not Tesco.
Tesco Stores Limited
Company Number: 519500
Registered in England
Registered Office: Tesco House, Delamare Road, Cheshunt, Hertfordshire EN8
9SL
VAT Registration Number: GB 220 4302 31
***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: memberh...@webstandardsgroup.org
***
***
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: memberh...@webstandardsgroup.org
***