位置相对在firefox [英] position relative in firefox
问题描述
可能重复:
Firefox支持位置:相对于表格元素?
下面是一个示例:全宽菜单作为表,ul-s作为下拉菜单。
http://cssdesk.com/dW7WS
任何帮助?
位置:相对
不适用于表格单元格(< td>
或 display:table-cell
)。
从规范:http://www.w3.org/TR/CSS21/visuren.html#propdef-position
'position:relative'对table-row-group,
table-header-group,table-footer-group,table -row,table-column-group,
table-column,table-cell和table-caption元素未定义。
所以,Firefox没有做错,虽然我希望它会复制其他浏览器,并使这项工作。
为了使这项工作,你需要添加一个包装 dd (并调整您的CSS选择器)
< table id =mainmenu>
< tr>
< td>
< div style =position:relative;>
< a href =#> ..< / a>
< ul>
..
< / ul>
< / div>
< / td>
..
< / tr>
< / table>
Possible Duplicate:
Does Firefox support position: relative on table elements?
Here is an example: full-width menu as a table and ul-s as dropdown menus. http://cssdesk.com/dW7WS
Works fine in ie and opera, but in firefox dropdown uls streched on whole screen!
Any help?
position: relative
does not work on table cells (<td>
or display: table-cell
).
From the spec: 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.
So, Firefox is doing nothing wrong, although I do wish it would copy other browsers and make this work.
To make this work, you need to add a wrapper div
inside each td
(and adjust your CSS selectors):
<table id="mainmenu">
<tr>
<td>
<div style="position: relative;">
<a href="#">..</a>
<ul>
..
</ul>
</div>
</td>
..
</tr>
</table>
这篇关于位置相对在firefox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!