我真的很希望我能正确表达这一点。请随时要求澄清所需。CSS:在悬停时更改下一个元素的z-index
每个那些在右上角的链接,这里是那些HTML:
<li>
<div class="description">
<p><strong>Title</strong><br>
<br />
This worksheet features diagrams of the different molecule structures found in solids liquids and gases, and descriptions of the different states. Simply label the diagram and draw a line to link the description to the diagram to complete the workshe</p>
</div>
<a class="fav_icon" data-id="71933" title="favorite">Fav</a>
</li>
div'description'具有display:none属性,直到li悬停,然后它有显示块。
右上角的链接(红色圆圈)是指向文章的链接。这有一个Z指数:99999以及现在位置绝对右上角。
问题是,如果在上空盘旋的div太长,运行在下面的DIV,右上方链接越过,像这样:
我所需要的电流盘旋的div的孩子.fav_icon要比悬停高,但是,我需要其余的要低。所以它应该是这样的:
任何想法如何实现这一目标?
编辑:CSS
这里是CSS:
.resource-preview {
.description {
display: none;
background-color: rgba(14, 134, 201, 0.9);
position: absolute;
top: 0;
left: 0;
height: auto;
padding: 10px;
z-index: 99999;
text-align: center;
border-radius: 4px;
p {
padding-top: 25px;
color: #fff;
padding: 10px;
}
}
&:hover {
.description {
display:block;
}
}
.fav_icon {
padding: 3px 5px;
height: 21px;
right: 5px;
top: 5px;
position: absolute;
left: auto;
outline: 3px solid white;
z-index: 9999;
}
您可以包括你的CSS太感谢 – sol
你可以发布你的完整代码吗?你可以用JavaScript来完成,或者你可以重构你的DOM并用CSS来完成。 – CoderPi
查看添加到主要的更改Q – JamesG