我有这个
,我希望在悬停在
上时显示
title
。问题是即使我在的边缘悬停,也会产生悬停效果。因此,当我在其上悬停时,
被视为一个正方形而不是圆形。这在Firefox上运行得很好,但在Chrome和Safari上不行。
Fiddle: http://jsfiddle.net/roeg629c/2/
注意:我不想改变图像的长宽比。图像应为父容器高度的100%
。
HTML
<div class="video_wrap update" video_name="rikthejmna">
<div class="related img_wrap"><img src="http://img.youtube.com/vi/XyzYVpJGRG8/hqdefault.jpg"></div>
<div class="title">rikthejm na</div>
</div>
CSS
.video_wrap {
width: 232px;
height: 232px;
display: inline-block;
border-radius: 116px;
overflow: hidden;
margin: 10px;
position: relative;
z-index: 2;
}
.img_wrap img {height: 100%}
.related {height: 100%;}
.title {
position: relative;
top: -50px;
left: 0px;
background: #fff;
height: 50px;
opacity: .5;
color: #f8008c;
font-size: 12px;
text-align: center;
line-height: 50px;
overflow: hidden;
cursor: default;
transition: all .5s ease-in;
}
.title:hover {opacity: 1}
.title
元素以匹配.video_wrap
。 - Alon Eitandiv
上使用当前边框半径时就可以工作了。 - Racil Hilanoverflow:hidden
。这会有点复杂,所以给我一些时间来想出解决方案。 - Racil Hilan