【发布时间】:2010-11-19 12:52:51
【问题描述】:
我有一个网页,其中有一个表格,其中一个 td 是 span,它使用较小的字体,向右浮动以将其放置在最右侧,以及负边距顶部,因此它与较大的文本对齐在 td 中。
使用 Firefox 3.0 可以正常工作,但我刚刚更新到 Firefox 3.5,并且边距将文本向上移动了太多。
我有另一个页面,其中有两个跨度条目,第二个具有较小的字体和负边距并显示相同的问题。
在第三页上,h3 后跟 span,较小的字体和负边距,它在 Firefox 3.5 中运行良好。
我今天安装了 Safari,它的行为与 Firefox 3.5 相同。我对 IE 没有意见,因为我有条件 CSS 来处理不同的 IE 版本(IE 7 使用负边距,但 IE 8 使用小的正边距)。
问题(终于:^):
有人知道 Firefox 3.5 的跨度和负边距渲染的变化吗?
我还能如何编写 HTML 或 CSS,以获得相同的结果而无需浏览器特定的 hack?
对于第二种情况,我将其从两个 span 更改为 h3 和 span,就像第三种情况一样。第一种情况确实是表格数据,所以我使用的是表格。这是问题的一部分:
<div id="content">
<table id="events2" cellspacing="0">
<tr class="month">
<td>August 2009<span class="gotop">(go to top)</span>
</td></tr>
<tr>
<td>
A table row</td>
</tr>
</table>
相关的(我希望)CSS 是:
div#content {
margin: 0;
padding: 0
width:100%;
background: white;
color: black;
font-size: 80%;
}
#events2 td {
padding: 4px;
border-bottom: 2px solid #BBB;
}
#events2 tr.month td {
padding: 0.125em 0;
font-size: 1.2em;
text-align: center;
border-top: 3px solid black;
border-bottom: 2px solid #BBB;
}
#events2 tr.month td .gotop {
float: right;
font-size: 0.6em;
margin-top: -1.4em;
padding-bottom: 0.3em;
}
提前致谢! PCM
【问题讨论】:
标签: css css-float margin html firefox3.5