开发者

Css image-rollover link problem - can't get the navigation to display horizontally in IE

开发者 https://www.devze.com 2023-01-23 19:31 出处:网络
Yeah I\'ve drawn a blank on the this one, and after playing about with it a bit the css isn\'t as neat as I\'d like it to be. The navigation / roll-over images work the way I want in Firefox, but I ca

Yeah I've drawn a blank on the this one, and after playing about with it a bit the css isn't as neat as I'd like it to be. The navigation / roll-over images work the way I want in Firefox, but I can't get it working in IE. IE stacks the rollover links on top of each other basically. http://www.plumberkendal.co.uk <--- its uploaded here, and you can sorta see what I mean.

1) display: inline; /// seems to kill the links in both IE and FF.

2) display: inline-block; /// This is what it is set too now, which appears to work FF and chrome but not IE. Any help greatly appreciated!

CSS

#nav_bar
{
margin-top: 10px;
float: right;
}

#navigation li, #navigation a
{
height:32px; display: inline-block;  
}

#navigation li 
{
margin:0; padding:0; 
list-style: none outside none; 
display: inline-block;
} 

#home li, #home a{width: 90px;}
#home{left: 0px; width: 90px;}
#home {background: url('../images/nav_bar.png') 0 0; }
#home a:hover {background: url('../images/nav_bar.png') 0 -39px; }

#portfolio li, #portfolio a {widt开发者_运维知识库h: 128px; }
#portfolio {left: 91px; width: 128px; }
#portfolio {background: url('../images/nav_bar.png') -94px 0px;  }
#portfolio a:hover{background: url('../images/nav_bar.png') -94px -39px;}

#contact li, #contact a {width: 90px; }
#contact {left: 130px; width: 90px; }
#contact { background: url('../images/nav_bar.png') -306px 0px;  }
#contact a:hover {background: url('../images/nav_bar.png') -306px -39px;  }

HTML

<div id="nav_bar">

<ul id="navigation">

<li id="home"><a href="index.php"><span>home</span></a></li>
<li id="portfolio"><a href="portfolio.php"><span>portfolio</span></a></li>
<li id="contact"><a href="contact.php"><span>contact</span></a></li> 
</ul>           

</div>


Try with this code (haven't tested it, but I think it should work):

#nav_bar            { margin-top: 10px; float: right; }
#navigation         { overflow:hidden; }
#navigation li      { float:left; margin:0; padding:0; list-style: none outside none; background-image:url('../images/nav_bar.png'); }
#navigation a       { display:block; height:32px; }
#navigation a:hover { background-image:url('../images/nav_bar.png'); }

#home               { background-position:0 0; }
#home a             { width:90px; }
#home a:hover       { background-position:0 -39px; }

#portfolio          { background-position:-94px 0; }
#portfolio a        { width:128px; }
#portfolio a:hover  { background-position:-94px -39px; }

#contact            { background-position:-306px 0; }
#contact a          { width:90px; }
#contact a:hover    { background-position:-306px -39px; }
0

精彩评论

暂无评论...
验证码 换一张
取 消