I have a site with a dropdown menu. When the menu expands it goes behind some li that i have later on. The z-index
on the li is 10 and currently the dropdown ul does not have a z-index but it has opacity:1
. Tried every combination of opacities and z-indexes in the mentioned elements but i cannot make it work as expected. I want the li to be behind the dropdown ul when it expands. The li is relatively positioned (my design needs that) and has a float property. The only way i can make this work is by using z-index:1
for the li but i don't want that as it messes up with some other elements. Any ideas?
我有一个带下拉菜单的网站。当菜单扩展时,它落后于我后来的一些李。 li上的z-index为10,当前下拉列表ul没有z-index但是它具有不透明度:1。在所提到的元素中尝试了不透明度和z索引的每个组合,但我无法使其按预期工作。我希望li在扩展时位于下拉列表后面。 li相对定位(我的设计需要)并具有浮动属性。我可以做这项工作的唯一方法是使用z-index:1作为li,但我不希望它因为它与其他一些元素混淆。有任何想法吗?
2 个解决方案
#1
1
If you want to use the z-index
property, we must put on the div position:absolute;
, position:fixed;
or position:relative;
如果你想使用z-index属性,我们必须把div位置:absolute;,position:fixed;或者职位:亲属;
#2
0
You should maybe take a look at your positions tags,
你应该看看你的位置标签,
If you don't give position value to your elements in your css, then your z-index value will not be considered by the browser.
如果您没有为css中的元素赋予位置值,那么浏览器将不会考虑您的z-index值。
#1
1
If you want to use the z-index
property, we must put on the div position:absolute;
, position:fixed;
or position:relative;
如果你想使用z-index属性,我们必须把div位置:absolute;,position:fixed;或者职位:亲属;
#2
0
You should maybe take a look at your positions tags,
你应该看看你的位置标签,
If you don't give position value to your elements in your css, then your z-index value will not be considered by the browser.
如果您没有为css中的元素赋予位置值,那么浏览器将不会考虑您的z-index值。