Safari 5.1会破坏CSS表格单元格间距 [英] Safari 5.1 breaks CSS table cell spacing
问题描述
我的网站在所有主流浏览器上正常工作,直到Safari 5.1的更新。现在,主导航被打破了。我在列表元素中的anchor元素上使用 display:table-cell
,并且还使用 font-size:0
hack删除菜单元素之间的间距。有没有人遇到这个问题,并有一个可以提供的解决方案?
My site was working fine across all major browsers right up until the update to Safari 5.1. Now, the primary navigation is busted up. I was using display:table-cell
on the anchor element within the list element and was also using the font-size:0
hack to remove the spacing in between menu elements. Has anyone else encountered this issue and have a solution they could offer up?
之前:
之后:
CSS:
#navigation {
padding-top: 7px;
}
#navigation ul.links, /* Main menu and secondary menu links */
#navigation .content ul /* Menu block links */ {
margin: 0;
padding: 0;
display: block;
font-size: 0; /* this is a hack so that the spacing between the menu buttons disappear
since they are inline-block elements, this should be unneccessary when
CSS3 is approved */
}
#navigation ul.links li, /* A simple method to get navigation links to appear in one line. */
#navigation .content li {
display: inline-block;
padding-right: 0;
padding-left: 0;
margin: 0;
/* below is a fix for IE7 to get the main navigation items lined up correctly
* in one row
*/
zoom: 1;
*display: inline;
}
#main-menu ul {
width: 100%;
}
#main-menu li {
width: 108px;
text-align: center;
padding-bottom: 7px;
font-size: 11pt;
}
#main-menu a {
display: table-cell;
width: inherit;
text-decoration: none;
font-size: 0.9em;
color: #035B9A;
background-color: white;
height: 30px;
vertical-align: middle;
}
HTML:
<div id="navigation">
<div class="section">
<h2 class="element-invisible">Main menu</h2>
<ul id="main-menu" class="links inline clearfix">
<li class="menu-379 first"><a href="/about-scrubbed">About Us</a></li>
<li class="menu-401"><a href="/" title="">Research</a></li>
<li class="menu-385"><a href="/education">Education</a></li>
<li class="menu-402"><a href="/" title="">Outreach</a></li>
<li class="menu-403 active-trail active"><a href="/news" title="" class="active-trail active">News & Events</a></li>
<li class="menu-439"><a href="/people">People</a></li>
<li class="menu-405"><a href="/" title="">Resources</a></li>
<li class="menu-406"><a href="/" title="">Publications</a></li>
<li class="menu-415 last"><a href="/partners">Partners</a></li>
</ul>
</div>
</div>
谢谢。
这是一个Drupal 7网站。
Just a note, this is a Drupal 7 site.
另外,我自由而谦虚地承认,我不是最好的CSS标记。我现在正在学习很多,只是想试穿。
Also I freely and humbly admit I am not the very best at CSS markup. I'm learning a lot right now and am just trying to scrape through.
推荐答案
通过使列表元素显示为块来解决并将其浮动到左边。
Solved by making the list elements display as block and float them to the left.
#navigation ul.links li, /* A simple method to get navigation links to appear in one line. */
#navigation .content li {
display: block;
float: left;
padding-right: 0;
padding-left: 0;
margin: 0;
/* below is a fix for IE7 to get the main navigation items lined up correctly
* in one row
*/
zoom: 1;
*display: inline;
}
这篇关于Safari 5.1会破坏CSS表格单元格间距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!