位置相对在firefox [英] position relative in firefox

查看:97
本文介绍了位置相对在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆