我创建了一个用户hovercard,但我有z-index问题。
如果您可以查看此演示,那么您可以看到有树形图= DEMO
将鼠标悬停在任何图像上,然后hovercar将打开,但Hovercard远远低于下图。我怎么能解决它,任何人都可以帮助我吗?
<div class="the-container">
<div class="summary-mask"></div>
<div class="summary" data-id="50"> <a href="http://kraigo.tumblr.com/" class="profile-ava"></a>
<div class="user-container"></div>
</div>
</div>
CSS
.summary-mask {
margin: 50px auto 0;
width: 50px;
height: 50px;
position: relative;
z-index: 1;
}
.loaded .summary-mask {
z-index: -1;
}
.profile-ava {
width: 50px;
height: 50px;
background-image: url(http://gravatar.com/avatar/3913c4e14034c0a7f28db2c632290c21?s=80);
border-radius: 3px;
background-size: 50px 50px;
display: block;
}
.summary a:hover:before {
content:'';
position: absolute;
display: block;
bottom: -10px;
left: 0;
height: 10px;
width: 100%;
z-index: 2;
}
.p-tooltip {
position: absolute;
margin-top: 10px;
top: 100%;
left: 50%;
margin-left: -140px;
width: 280px;
max-height: 120px;
border-radius: 5px;
overflow: hidden;
background-color: #F0F0F0;
visibility: hidden;
opacity: 0;
transition: all 0.5s ease;
}
答案 0 :(得分:0)
这应该有效:
http://jsfiddle.net/sw4ev8b4/14/
删除你在那里的所有花哨的z-index样式,只需在工具提示中添加一个正z-index z-index:999;
:
.summary {
margin: -50px auto 0;
width: 50px;
height: 50px;
position: relative;
}
.summary-mask {
margin: 50px auto 0;
width: 50px;
height: 50px;
position: relative;
}
.p-tooltip {
position: absolute;
margin-top: 10px;
top: 100%;
left: 50%;
margin-left: -140px;
width: 280px;
max-height: 120px;
border-radius: 5px;
overflow: hidden;
background-color: #F0F0F0;
visibility: hidden;
opacity: 0;
transition: all 0.5s ease;
z-index:999;
}