我想通过在内容div上的鼠标悬停在后台(100%宽度的浏览器)有一个div。一切都很好,但我不知道是否有解决方案,使背景div作为父母的高度? 不使用Jquery?纯粹的CSS会很棒! 谢谢!问题的做一个绝对定位的div与父母相同的高度(不相对)
.content {
/* \t position: relative; >> will make the absoluted positioned div 100%width of the browser*/
z-index: 1;
}
.background {
position: absolute;
background: aqua;
width: 100%;
right: 0px;
left: 0px;
z-index: -1;
display: none;
}
.post:hover .background {
display: block;
height: 10%;
/* WHAT TO DO? */
}
<div class="post">
<div class="content">
<div class="background"></div>
…content…
</div>
</div>
部分是:“后”分区处于centerd“主”分区与给定的宽度,我希望有一个背景的div有100%的宽度视
对不起的,这是一个有点难以解释我需要什么,所以我做一个小的草图位置:
'顶部:0;底部:0;' – ctwheels
这将使视 – buckdanny
的DIV宽/高100%,你能不能改一下你的问题的话,我不太明白你打算完成 – ctwheels