简体   繁体   English

显示 <ul class> 高于父母 <div class> 使用z-index?

[英]Display <ul class> above parent <div class> using z-index?

Example: http://betafreshmedia.com/nathan/coffee.html 示例: http//betafreshmedia.com/nathan/coffee.html

When you click a category, I want the dropdown to appear ABOVE the rest of the categories. 当您单击类别时,我希望下拉菜单显示在其余类别的上方。 Right now everything is position:relative so they shift around to accomodate the <ul> . 现在,所有内容都position:relative因此它们移动以适应<ul> I'd like to use position:absolute with a z-index, but can't seem to get it to work. 我想使用带有z-index的position:absolute ,但似乎无法使其正常工作。 Please note the javascript at the end of <body> has to correspond with whatever we decide to do. 请注意<body>末尾的javascript必须与我们决定执行的操作相对应。

Thanks! 谢谢!

Just take the z-index off the trigger divs, and use position: absolute on the ul and it'll work. 只需将z-index从触发器div上移开,然后在ul上使用position: absolute ,它将起作用。 Only ever use z-index if you have to. 仅在必要时使用z-index If elements don't explicitly require z-index , don't set it. 如果元素不明确要求z-index ,请不要设置它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM