Add Body Class Just For IE

0
0

How to add IE class ?

  • You must to post comments
0
0
<!--[if IE ]> 
            <body class="ie"> 
<![endif]--> 
<!--[if !IE]>--> 
            <body> 
<!--<![endif]-->

Or more robust version putting class on HTML element:

<!DOCTYPE html> 
<!--[if IEMobile 7 ]> <html dir="ltr" lang="en-US"class="no-js iem7"> <![endif]--> 
<!--[if lt IE 7 ]> <html dir="ltr" lang="en-US" class="no-js ie6 oldie"> <![endif]--> 
<!--[if IE 7 ]> <html dir="ltr" lang="en-US" class="no-js ie7 oldie"> <![endif]--> 
<!--[if IE 8 ]> <html dir="ltr" lang="en-US" class="no-js ie8 oldie"> <![endif]--> 
<!--[if (gte IE 9)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html dir="ltr" lang="en-US" class="no-js"><!--<![endif]-->

Now you can write IE specific styles in a regular stylesheet, by prefacing the CSS selectors with .ie

 
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.