How to fix template files in IE6/IE7 when everything is working fine in firefox?



Simply, create a css for IE6/IE7 say it is ie6.css and/or ie7.css and add the following lines to page.tpl.php:

 

<!--[if IE 6]>
<style type="text/css" media="all">@import "<?php print base_path() . path_to_theme() ?>/css/ie6.css";</style>
<![endif]-->

<!--[if IE 7]>
<style type="text/css" media="all">@import "<?php print base_path() . path_to_theme() ?>/css/ie7.css";</style>
<![endif]-->

 

in page.tpl.php as follows:

 

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language ?>" lang="<?php print $language ?>">
<head>
<title><?php print $head_title ?></title>
<?php print $head ?>
<?php print $styles ?>
<?php print $scripts ?>

<style type="text/css" media="print">@import "<?php print base_path() . path_to_theme() ?>/print.css";</style>
<style type="text/css" media="print">@import "<?php print base_path() . path_to_theme() ?>/css/base.css";</style>
<!--[if IE 6]>
<style type="text/css" media="all">@import "<?php print base_path() . path_to_theme() ?>/css/ie6.css";</style>
<![endif]-->

<!--[if IE 7]>
<style type="text/css" media="all">@import "<?php print base_path() . path_to_theme() ?>/css/ie7.css";</style>
<![endif]-->

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

</head>

This would load ie.css.

ie.css would have ie css hacks.