当两个元素具有固定位置时 z-index 失败
z-index fails when two elements have a fixed position
我有两个固定元素(聊天框和 Cookies 广告)无法正确定位,即使我添加 z-index
风格
聊天:
bottom: 0;
position: fixed !important;
right: 40px;
z-index: 9998;
Cookies:
background: #000000 none repeat scroll 0 0;
bottom: 0;
box-shadow: 0 0 10px 0 #ffffff;
color: #fff;
font-family: arial;
font-size: 14px;
left: 0;
line-height: 1.3em;
opacity: 0.5;
position: fixed;
text-align: center;
width: 100%;
z-index: 9999;
更多详情,您可以在本页找到:
http://www.backlabel.com/
HTML太长了,复制过去..
至于 z-index,子元素总是从其父元素继承 z-index,所以我想解决这个问题,您应该查看那些 div 的父元素。
如果您想要聊天上方的 cookie div
,请将较高的 z-index
设置为 .footer-container
div
对于两个位置固定的子元素,Z-index 工作得很好。
您只需要检查元素的层次结构级别。
我有两个固定元素(聊天框和 Cookies 广告)无法正确定位,即使我添加 z-index
风格
聊天:
bottom: 0;
position: fixed !important;
right: 40px;
z-index: 9998;
Cookies:
background: #000000 none repeat scroll 0 0;
bottom: 0;
box-shadow: 0 0 10px 0 #ffffff;
color: #fff;
font-family: arial;
font-size: 14px;
left: 0;
line-height: 1.3em;
opacity: 0.5;
position: fixed;
text-align: center;
width: 100%;
z-index: 9999;
更多详情,您可以在本页找到: http://www.backlabel.com/
HTML太长了,复制过去..
至于 z-index,子元素总是从其父元素继承 z-index,所以我想解决这个问题,您应该查看那些 div 的父元素。
如果您想要聊天上方的 cookie div
,请将较高的 z-index
设置为 .footer-container
div
对于两个位置固定的子元素,Z-index 工作得很好。 您只需要检查元素的层次结构级别。