开发者

CSS margin issues only in Chrome & Safari

I'm finishing up my first site: http://www.audio-agent.com/.

I just noticed that, while it looks correct in Firefox, the navigation menu padding and vertical alignment is off when viewed in Safari / Chrome.

Here's all the CSS I'm using for the menu:

ul#navigation {
background:url(images/navBgSlice.png);
color:#fff;
padding:6px 40px 6px 40px;
font-size:14px;
text-transform:uppercase;
text-align:right;
}

ul#navigation a.current {
color:#fcff00;
}

ul#navigation a:link, ul#navigation a:visited,
p.flip a:link, p.flip a:visited {
font-weight:normal;
}

ul#navigation a:active, ul#navigation a:hover,
p.flip a:active, p.flip a:hover 开发者_开发知识库{
text-decoration:none;
}

ul#navigation li {
display:inline-block;
padding:0 10px;
}

ul#navigation li:last-child {
padding-right:0;
}

And the HTML is just:

<ul id="navigation">
    <a class="current" href="<?php blogInfo('url'); ?>"><li>Services</li></a> |
    <a href="<?php blogInfo('url'); ?>/clients"><li>Clients</li></a> |
    <a href="<?php blogInfo('url'); ?>/news"><li>News</li></a>
</ul>

Any idea what could be going on? Any help is much appreciated!


Change:

ul#navigation li:last-child {
padding-right:0;
}

To:

ul#navigation li.last-child {
padding-right:0;
}

And add class="last-child" to your list:

<a href="<?php blogInfo('url'); ?>/news"><li class="last-child">News</li></a>

If you want full cross-browser support, this is the simplest way to accomplish this - As earlier IE and Safari struggle with the pseudoclass :last-child

Hope this helps.

Here's an example: http://jsfiddle.net/DAyjz/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜