简体   繁体   English

z-index 在 li 导航栏上不起作用

[英]z-index does not work on li navbar

I use the navbar bootstrap (.navbar-inverse, .navbar-static-top) and I would like to apply a z-index to a particular "li" so that it passes over a div opacity to 0.5.我使用导航栏引导程序(.navbar-inverse,.navbar-static-top),我想将 z-index 应用于特定的“li”,以便它通过 div 不透明度到 0.5。 (the "be stronger" "li") (“变强”“丽”)

http://www.bootply.com/132530 http://www.bootply.com/132530

Problem: even with a z-index and position: relative, "li" is not displayed over the div.问题:即使使用 z-index 和 position: relative,“li”也不会显示在 div 上。

I tried to apply this css to each parent li, one by one, but it only works for the last parent: div.navbar我试图将这个 css 一个一个地应用到每个父 li,但它只适用于最后一个父:div.navbar

<div style="z-index:8888" class="navbar navbar-inverse navbar-static-top"> 

works, but I do not want to show all the navbar有效,但我不想显示所有导航栏

Is it possible to show only this "li" ?是否可以只显示这个“li”?

thank you in advance先感谢您

No, you can't. 不,你不能。 You will need to change your HTML markup in order to do that. 您需要更改HTML标记才能执行此操作。

"If an element B sits on top of element A, a child element of element A can never be higher than element B." “如果元素B位于元素A的顶部,则元素A的子元素永远不会高于元素B.”

source 资源

Thank you all for your replies, I explored different solutions, but nothing works. 谢谢大家的回复,我探索了不同的解决方案,但没有任何效果。

@ Matheus: I can not change my HTML markup for several reasons, I will find a way to bring up another li I would move in javascript. @Matheus:由于几个原因,我无法更改我的HTML标记,我将找到一种方法来提出另一个我将在javascript中移动的li。

I know it is not clean, but in my situation, I can not do anything else. 我知道它不干净,但在我的情况下,我不能做任何其他事情。

Thank you again. 再次感谢你。

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

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