css Blogger 中的 z-index 错误
css z-index bug in blogger
我正在创建一个新的博客模板,但不幸的是我遇到了一个问题。
我正在尝试做的简单示例。
<div class='container'>
<div class='slider'></div>
<div class='posts'></div>
</div>
默认情况下,第二个 div(帖子)的 z-index 应该高于第一个。
see this demo
并查看 this pic and now see what should be done here
,所以有什么问题!
这是我的 blog
要明显更高 z-index
,元素必须是
- 其他元素之后或
- 当前一个元素具有 relative/absolute 位置时,具有
position:relative;
或绝对值。
.d1{
width: 100%;
height:50px;
background: tomato;
position: relative;
}
.d2{
width:80%;
height:200px;
background: blue;
margin: -30px auto 0 auto;
position: relative; /* Try removing this - it will be 'below' d1 because d1 has position:relative; */
}
<div class='container'>
<div class='d1 slider'></div>
<div class='d2 posts'></div>
</div>
在您的情况下,这意味着将 position:relative;
添加到 .container
class。
我正在创建一个新的博客模板,但不幸的是我遇到了一个问题。 我正在尝试做的简单示例。
<div class='container'>
<div class='slider'></div>
<div class='posts'></div>
</div>
默认情况下,第二个 div(帖子)的 z-index 应该高于第一个。 see this demo 并查看 this pic and now see what should be done here ,所以有什么问题! 这是我的 blog
要明显更高 z-index
,元素必须是
- 其他元素之后或
- 当前一个元素具有 relative/absolute 位置时,具有
position:relative;
或绝对值。
.d1{
width: 100%;
height:50px;
background: tomato;
position: relative;
}
.d2{
width:80%;
height:200px;
background: blue;
margin: -30px auto 0 auto;
position: relative; /* Try removing this - it will be 'below' d1 because d1 has position:relative; */
}
<div class='container'>
<div class='d1 slider'></div>
<div class='d2 posts'></div>
</div>
在您的情况下,这意味着将 position:relative;
添加到 .container
class。