CSS图像翻转链接问题-无法让导航在IE中水平显示

发布于 2024-10-01 11:34:58 字数 1685 浏览 1 评论 0原文

是的,我在这个上画了一个空白,在玩了一下之后,CSS 并不像我希望的那么整洁。导航/翻转图像在 Firefox 中按照我想要的方式工作,但我无法在 IE 中工作。 IE 基本上将翻转链接堆叠在一起。 http://www.plumberkendal.co.uk <--- 已上传至此处,您可以有点明白我的意思了。

1)显示方式:内嵌; /// 似乎杀死了 IE 和 FF 中的链接。

2)显示:inline-block; /// 这也是现在的设置,它似乎适用于 FF 和 chrome,但不适用于 IE。非常感谢任何帮助!

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 {width: 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>

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 {width: 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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

后知后觉 2024-10-08 11:34:58

尝试使用此代码(尚未测试过,但我认为它应该有效):

#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; }

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; }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文