CSS工具提示被切断 [英] CSS tooltip getting cut off
问题描述
我有一个CSS工具提示,当悬停的项目太靠近内容区域的边缘时,该工具提示将被切断.请参阅这篇文章底部的链接:http://blog.betbright.com/top-stories/manchester-united-v-club-brugge-betting-preview/
I have a CSS tooltip that is being cut off when the hovered item is too close to the edge of the content area. See the links towards the bottom of this post: http://blog.betbright.com/top-stories/manchester-united-v-club-brugge-betting-preview/
这是我用于工具提示的代码:
Here is the code I'm using for the tooltip:
a.tooltip {
position: relative;
display: inline;
}
a.tooltip span {
position: absolute;
width:110px;
color: #FFFFFF;
background: #00A1E0;
height: 30px;
line-height: 30px;
text-align: center;
visibility: hidden;
border-radius: 6px;
}
a.tooltip span:after {
content: '';
position: absolute;
top: 100%;
left: 50%;
margin-left: -8px;
width: 0; height: 0;
border-top: 8px solid #00A1E0;
border-right: 8px solid transparent;
border-left: 8px solid transparent;
}
a:hover.tooltip span {
visibility: visible;
opacity: 1;
bottom: 30px;
left: 100%;
margin-left: -76px;
z-index: 999;
}
任何建议您停止切割工具提示的解决方案,将不胜感激.
Any solutions you can recommend to stop the tooltip being cut would be appreciated.
谢谢,保罗
推荐答案
您应将 .entry-content
类的 overflow
属性设置为 visible
而不是 hidden
.您当前的设置将隐藏所有不符合该 div
的内容.由于您的工具提示将部分显示在 .entry-content div
的外部,因此除非您更改 overflow
属性,否则将切除一部分.因此,您的错误不在工具提示中,而是在父元素中.
You should set the overflow
property on your .entry-content
class to visible
instead of hidden
. Your current setting hides everything that does not fit within that div
. Since your tooltip would be displayed partly outside your .entry-content div
, a part is cut of unless you change the overflow
property. So, your error is not in the tooltip, it's in a parent element.
这篇关于CSS工具提示被切断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!