php - conditional classes drupal 7 and IE9 -


i wish use conditional class detect if ie9 being used , apply css accordingly class navigation if is.

i have added following lineto html.tpl.php file

<!--[if ie 9]><html <?php print $html_attributes; ?> class="ie9nav"><![endif]-->

in stylsheet.css file, current class (which works).

#navigation {background-image: blah.jpg}

i added

#navigation .ie9nav {background-color: fff;}

but doesn't work. have done wrong?

why don't directly try php itself..

here code snippet handy..

if(preg_match('/msie/i',$_server['http_user_agent'])) {     echo '<html class="ieclass">'; } else {     echo '<html class="none-ie">; } 

hope helps..


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -