[英]z-index issue with fixed and relative div's in a container
I am facing an issue with z-index my layout draft form is here : jsfiddle 我面临着z-index的问题,我的布局草稿表格在这里: jsfiddle
I am trying to achieve the following 我正在努力实现以下目标
The #topBar
, #Navigations
, #infobar
needs to be fixed always.(achieved) 该
#topBar
, #Navigations
, #infobar
必须始终固定。(已经实现)
Z-index of the #mainMenu
. #mainMenu
Z-index。 Needs to be between #contentBorder
and #content
(has a shadow). 需要介于
#contentBorder
和#content
之间(有阴影)。
Z-index of the #categorys
. #categorys
Z-index。 Needs to be top of the #contentBordera
and #content
. 需要位于
#contentBordera
和#content
顶部。
any help will be highly appreciated. 任何帮助将不胜感激。
Seen on www.w3schools.com 见www.w3schools.com
Definition and Usage
定义和用法
The z-index property specifies the stack order of an element.
z-index属性指定元素的堆栈顺序。
An element with greater stack order is always in front of an element with a lower stack order.
具有较高堆叠顺序的元素始终位于具有较低堆叠顺序的元素之前。
Note: z-index only works on positioned elements (position:absolute, position:relative, or position:fixed).
注意:z-index仅适用于定位的元素(position:absolute,position:relative或position:fixed)。
The solution here is give to the #sideBar a higher index than to the #contentBorder div, then all sub elements of #sideBar can overlap those within the #contentBorder: 这里的解决方案是给#sideBar一个比#contentBorder div高的索引,然后#sideBar的所有子元素可以与#contentBorder内的那些子元素重叠:
#topBar {
z-index:2000;
}
#sideBar {
z-index: 1900;
}
#mainMenu {
z-index:1500;
}
#categorys {
z-index:1800;
}
#contentBorder {
z-index:1400;
}
#content {
z-index:1600;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.