Safari 5.1 breaks CSS table cell spacing(Safari 5.1 打破 CSS 表格单元格间距)
问题描述
在更新到 Safari 5.1 之前,我的网站在所有主要浏览器上都运行良好.现在,主要导航被破坏了.我在列表元素中的锚元素上使用 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="IiZndDtSZXNlYXJjaCZsdDsvYSZndDsmbHQ7L2xpJmd0OwogICAgICAgICAgICAmbHQ7bGkgY2xhc3M9"menu-385"><a href="/education">Education</a></li>
<li class="menu-402"><a href="/" title="IiZndDtPdXRyZWFjaCZsdDsvYSZndDsmbHQ7L2xpJmd0OwogICAgICAgICAgICAmbHQ7bGkgY2xhc3M9"menu-403 active-trail active"><a href="/news" title="IiBjbGFzcz0="active-trail active">News & Events</a></li>
<li class="menu-439"><a href="/people">People</a></li>
<li class="menu-405"><a href="/" title="IiZndDtSZXNvdXJjZXMmbHQ7L2EmZ3Q7Jmx0Oy9saSZndDsKICAgICAgICAgICAgJmx0O2xpIGNsYXNzPQ=="menu-406"><a href="/" title="IiZndDtQdWJsaWNhdGlvbnMmbHQ7L2EmZ3Q7Jmx0Oy9saSZndDsKICAgICAgICAgICAgJmx0O2xpIGNsYXNzPQ=="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 表格单元格间距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Safari 5.1 打破 CSS 表格单元格间距


- 如何向 ipc 渲染器发送添加回调 2022-01-01
- 如何调试 CSS/Javascript 悬停问题 2022-01-01
- 在不使用循环的情况下查找数字数组中的一项 2022-01-01
- 如何显示带有换行符的文本标签? 2022-01-01
- 从原点悬停时触发 translateY() 2022-01-01
- 为什么我的页面无法在 Github 上加载? 2022-01-01
- 为什么悬停在委托事件处理程序中不起作用? 2022-01-01
- 使用 iframe URL 的 jQuery UI 对话框 2022-01-01
- 我不能使用 json 使用 react 向我的 web api 发出 Post 请求 2022-01-01
- 是否可以将标志传递给 Gulp 以使其以不同的方式 2022-01-01