Friday, July 29, 2011

Add Separate CSS for IE - Drupal 6

There are THREE ways by which we can include css for IE with respective to the versions of IE.

1)From active Themes .info file.
2)From active Themes template file (page.tpl.php).

1)From active Themes .info file. (Eg: Zen theme)

 In Themes .info file, there is a section adds CSS files to your theme, there we can include our custom css file for different IE versions.

Code:

; Set the conditional stylesheets that are processed by IE.

;For all versions of IE browser
conditional-stylesheets[if IE][all][]  = css/ie.css

;For  lte (less than or equal to) IE 7 browser - applies to all versions less than or equal to IE 7 (IE7, IE6, IE5 ,.....)
conditional-stylesheets[if lt IE 7][all][] = css/ie.css

;For  lt (less than) IE 7 browser - applies to all versions less than IE 7 (IE6, IE5 ,.....)
conditional-stylesheets[if lte IE 7][all][] = css/ie.css

;For  gte (greater than or equal to) IE 7 browser - applies to all versions greater than IE 7 (IE7, IE8 , IE9,.....)
conditional-stylesheets[if gte IE 7][all][] = css/ie.css


;For  gt (greater than) IE 7 browser - applies to all versions greater than IE 7 (IE8 , IE9,.....)
conditional-stylesheets[if gt IE 7][all][] = css/ie.css 

 ;For only IE 7 browser - applies to only IE 7
conditional-stylesheets[if IE 7][all][] = css/ie7.css 

For More Information -  Click Here


2)From active Theme template file (page.tpl.php).

 Code to be included in <head> </head> tag.

/*For all IE browsers version less than or equal to IE7*/
<!--[if lte IE 7]>
  <link type="text/css" rel="stylesheet" media="all" href="sites/all/themes/(name_of_the_theme)/css/ie7.css" />
<![endif]-->

/*For all IE browsers version less than  IE7*/
<!--[if lt IE 7]>
  <link type="text/css" rel="stylesheet" media="all" href="sites/all/themes/(name_of_the_theme)/css/ie7.css" />
<![endif]-->

/*For all IE browsers version greater than or equal to IE7*/
<!--[if gte IE 7]>
  <link type="text/css" rel="stylesheet" media="all" href="sites/all/themes/(name_of_the_theme)/css/ie7.css" />
<![endif]-->

/*For all IE browsers version greater than IE7*/
<!--[if gt IE 7]>
  <link type="text/css" rel="stylesheet" media="all" href="sites/all/themes/(name_of_the_theme)/css/ie7.css" />
<![endif]-->

/*For only IE 7 browser - applies to only IE 7*/
<!--[if IE 7]>
  <link type="text/css" rel="stylesheet" media="all" href="sites/all/themes/(name_of_the_theme)/css/ie7.css" />
<![endif]-->


/*For all IE browser - applies to all IE versions*/
<!--[if IE]>
  <link type="text/css" rel="stylesheet" media="all" href="sites/all/themes/(name_of_the_theme)/css/ie7.css" />
<![endif]-->



No comments:

Post a Comment