bluemagic
May 29th, 2009, 09:59 PM
I did a lot of googling about this, but could not fix my problems exactly.
I'm using a CSS navigational menu with no drop-down features - just a simple horizontal menu. It was working fairly fine on the main website (with an IE fix/hack - just one annoying quirk - that in IE8, the top and bottom boundary lines for the menu merge into one dark line at the top of the menu - no idea how to fix that as well), but I'm really having trouble integrating it into the .tpl index file of an ecommerce shop that I've heavily modified.
It works fine in Firefox and IE8, but the IE fix does not fix the exact same code the same way it did for .html files. In IE 7 and earlier, the menu looks like a waterfall instead of a straight line.
The HTML for the menu is this:
<div class="horizontallinetop"></div>
<div id="menu">
<ul>
<li><a href="../specialevents.html">Special Events</a></li>
<li><a href="../shop/">Shop</a></li>
<li><a href="../gallery.html">Gallery</a></li>
<li><a href="../labels.html">Labels</a></li>
<li><a href="../history.html">History</a></li>
<li><a href="../contactus.html">Contact</a></li>
</ul>
</div>
<div class="horizontallinebottom"></div>
The CSS is this:
#menu ul {margin:0 auto; padding:0; list-style:none; display:table; white-space:nowrap; list-style:none; height:2em; position:relative; font-size:1.25em}
#menu li {display:table-cell; margin:0; padding:0}
#menu li a {display:block; float:left; height:2em; line-height:2em; color:#333; text-decoration:none; font-family:"palatino linotype", verdana, serif; font-weight:bold; text-align:center; padding:0 0 0 12px; cursor:pointer}
#menu li a b {float:left; display:block; padding:0 12px 0 0}
#menu li.current a {color:#000}
#menu li.current a b {}
#menu li a:hover {color:#003399}
#menu li a:hover b {}
#menu li.current a:hover {cursor:default;}
#menu li.current a:hover b {}
.horizontallinebottom {border-top: 0.1em solid #555753; padding: 0 0 0.5em 0}
.horizontallinetop {border-bottom: 0.1em solid #555753; padding 0.5em 0 0 0}
The IE fix is this:
<!--[if IE]>
<style type="text/css">
#menu ul {display:inline-block;}
#menu ul {display:inline;}
#menu ul li {float:left;}
#menu {text-align:center;}
</style>
<![endif]-->
There's probably a more elegant way to do it than the way I did it, especially with the "horizontallinebottom" and "horizontallinetop" elements. I really do not understand why IE8 (but not 7 and previous) render those elements incorrectly.
My main question, I suppose, is why the IE fix does not work in the .tpl file the same way it did the in the .html file, and what I should do about this issue. I'm sure you guys will find way more mistakes in the code, and I welcome it. Thanks in advance!
I'm using a CSS navigational menu with no drop-down features - just a simple horizontal menu. It was working fairly fine on the main website (with an IE fix/hack - just one annoying quirk - that in IE8, the top and bottom boundary lines for the menu merge into one dark line at the top of the menu - no idea how to fix that as well), but I'm really having trouble integrating it into the .tpl index file of an ecommerce shop that I've heavily modified.
It works fine in Firefox and IE8, but the IE fix does not fix the exact same code the same way it did for .html files. In IE 7 and earlier, the menu looks like a waterfall instead of a straight line.
The HTML for the menu is this:
<div class="horizontallinetop"></div>
<div id="menu">
<ul>
<li><a href="../specialevents.html">Special Events</a></li>
<li><a href="../shop/">Shop</a></li>
<li><a href="../gallery.html">Gallery</a></li>
<li><a href="../labels.html">Labels</a></li>
<li><a href="../history.html">History</a></li>
<li><a href="../contactus.html">Contact</a></li>
</ul>
</div>
<div class="horizontallinebottom"></div>
The CSS is this:
#menu ul {margin:0 auto; padding:0; list-style:none; display:table; white-space:nowrap; list-style:none; height:2em; position:relative; font-size:1.25em}
#menu li {display:table-cell; margin:0; padding:0}
#menu li a {display:block; float:left; height:2em; line-height:2em; color:#333; text-decoration:none; font-family:"palatino linotype", verdana, serif; font-weight:bold; text-align:center; padding:0 0 0 12px; cursor:pointer}
#menu li a b {float:left; display:block; padding:0 12px 0 0}
#menu li.current a {color:#000}
#menu li.current a b {}
#menu li a:hover {color:#003399}
#menu li a:hover b {}
#menu li.current a:hover {cursor:default;}
#menu li.current a:hover b {}
.horizontallinebottom {border-top: 0.1em solid #555753; padding: 0 0 0.5em 0}
.horizontallinetop {border-bottom: 0.1em solid #555753; padding 0.5em 0 0 0}
The IE fix is this:
<!--[if IE]>
<style type="text/css">
#menu ul {display:inline-block;}
#menu ul {display:inline;}
#menu ul li {float:left;}
#menu {text-align:center;}
</style>
<![endif]-->
There's probably a more elegant way to do it than the way I did it, especially with the "horizontallinebottom" and "horizontallinetop" elements. I really do not understand why IE8 (but not 7 and previous) render those elements incorrectly.
My main question, I suppose, is why the IE fix does not work in the .tpl file the same way it did the in the .html file, and what I should do about this issue. I'm sure you guys will find way more mistakes in the code, and I welcome it. Thanks in advance!