matt_b
07-27-2009, 03:31 PM
Hi all,
I've been banging my head off the desk for what seems like ages now, and need some help!
I've created a nav bar with rounded corners, which works perfectly in all the latest browsers (FF3/Opera 9/Chrome2/IE8), but in IE6/7 there is something odd going on with padding. I've attached screenshots of the navbar, both working in FF3 and broken in IE7.
The code is below:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Nav Testing</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
</head>
<body>
<ul id="navigation">
<li><a href="#"><span><span>Home</span></span></a></li>
<li><a href="#"><span><span>Services</span></span></a></li>
<li><a href="#"><span><span>Take a tour</span></span></a></li>
<li><a href="#"><span><span>About us</span></span></a></li>
<li><a href="#"><span><span>Contact us</span></span></a></li>
</ul>
</body>
</html>
*
{
padding: 0;
margin: 0;
border: 0;
}
#navigation li
{
list-style: none;
float: left;
display: block;
padding-top: 20px;
}
#navigation a
{
font-family: "Arial";
text-decoration: none;
font-weight: bold;
color: white;
background: url(tab-left.jpg) left top no-repeat;
padding-left: 9px;
padding-top: 7px;
padding-bottom: 4px;
position: relative;
float: none;
}
#navigation a span
{
background: url(tab-tile.jpg) top repeat-x;
padding-top: 7px;
padding-bottom: 4px;
position: relative;
float: none;
}
#navigation a span span
{
background: url(tab-right.jpg) right top no-repeat;
padding-right: 9px;
position: relative;
float: none;
}
#navigation a:hover
{
background: url(tab-left-orange.jpg) left top no-repeat;
}
#navigation a:hover span
{
background: url(tab-tile-orange.jpg) top repeat-x;
}
#navigation a:hover span span
{
background: url(tab-right-orange.jpg) right top no-repeat;
}
For some reason in IE6/7, the padding seems to be cumulative, such that the images for the a and the two spans are all on the wrong level rather than aligned correctly.
Can someone point me in the right direction? I think the problem is down to Internet Explorer badness, but don't know which "hack" to apply to fix it!
Thanks
Matt
I've been banging my head off the desk for what seems like ages now, and need some help!
I've created a nav bar with rounded corners, which works perfectly in all the latest browsers (FF3/Opera 9/Chrome2/IE8), but in IE6/7 there is something odd going on with padding. I've attached screenshots of the navbar, both working in FF3 and broken in IE7.
The code is below:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Nav Testing</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
</head>
<body>
<ul id="navigation">
<li><a href="#"><span><span>Home</span></span></a></li>
<li><a href="#"><span><span>Services</span></span></a></li>
<li><a href="#"><span><span>Take a tour</span></span></a></li>
<li><a href="#"><span><span>About us</span></span></a></li>
<li><a href="#"><span><span>Contact us</span></span></a></li>
</ul>
</body>
</html>
*
{
padding: 0;
margin: 0;
border: 0;
}
#navigation li
{
list-style: none;
float: left;
display: block;
padding-top: 20px;
}
#navigation a
{
font-family: "Arial";
text-decoration: none;
font-weight: bold;
color: white;
background: url(tab-left.jpg) left top no-repeat;
padding-left: 9px;
padding-top: 7px;
padding-bottom: 4px;
position: relative;
float: none;
}
#navigation a span
{
background: url(tab-tile.jpg) top repeat-x;
padding-top: 7px;
padding-bottom: 4px;
position: relative;
float: none;
}
#navigation a span span
{
background: url(tab-right.jpg) right top no-repeat;
padding-right: 9px;
position: relative;
float: none;
}
#navigation a:hover
{
background: url(tab-left-orange.jpg) left top no-repeat;
}
#navigation a:hover span
{
background: url(tab-tile-orange.jpg) top repeat-x;
}
#navigation a:hover span span
{
background: url(tab-right-orange.jpg) right top no-repeat;
}
For some reason in IE6/7, the padding seems to be cumulative, such that the images for the a and the two spans are all on the wrong level rather than aligned correctly.
Can someone point me in the right direction? I think the problem is down to Internet Explorer badness, but don't know which "hack" to apply to fix it!
Thanks
Matt