<分区>
<分区>
Possible Duplicate:
Does Firefox support position: relative on table elements?
这是一个示例:全 Angular 菜单作为表格,ul-s 作为下拉菜单。 http://cssdesk.com/dW7WS
在 ie 和 opera 中工作正常,但在 firefox 下拉列表中 uls 在整个屏幕上拉伸(stretch)!
有什么帮助吗?
最佳答案
position: relative
不适用于表格单元格( <td>
或 display: table-cell
)。
来自规范:http://www.w3.org/TR/CSS21/visuren.html#propdef-position
The effect of 'position:relative' on table-row-group, table-header-group, table-footer-group, table-row, table-column-group, table-column, table-cell, and table-caption elements is undefined.
因此,Firefox 没有做错任何事,尽管我确实希望它能复制其他浏览器并使它正常工作。
要完成这项工作,您需要添加一个包装器 div
每个内部 td
(并调整您的 CSS 选择器):
<table id="mainmenu">
<tr>
<td>
<div style="position: relative;">
<a href="#">..</a>
<ul>
..
</ul>
</div>
</td>
..
</tr>
</table>
关于css - 在 Firefox 中的相对位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7629326/