发生这种情况的真正原因是浏览器仅在子元素未定位(即 has position:static;
)时正确裁剪子元素。我冒昧地更改了您的标记并创建了一个新的 jsFiddle,它可以在 Chrome、Firefox 和 IE10 上正常工作(也可以在 IE9 上工作,但没有过渡)。
标记:
<div class="serviceContainer"> <!-- added a container -->
<div class="service lorange">
<!-- removed div.img -->
<div class="title two-lines"><span>P-Accelerator for Start-Ups</span></div>
</div>
</div>
CSS:(我试图在小提琴中只包含相关的 CSS)
#services-grid .serviceContainer{ /* added a new container which the has the background image */
background:url(http://foto.hrsstatic.com/fotos/0/3/256/256/80/FFFFFF/http%3A%2F%2Ffoto-origin.hrsstatic.com%2Ffoto%2F3%2F9%2F4%2F0%2F394033%2F394033_p_465430.jpg/zoKRL9Oq7JFnhFhhAn%2FfTQ%3D%3D/128,128/6/Catalonia_Yucatan_Beach-Quintana_Roo-Pool-394033.jpg) center center no-repeat;
float:left;
border-radius:35px;
-moz-border-radius:35px;
-webkit-border-radius:35px;
-ms-border-radius:35px;
margin:0 15px;
overflow:hidden;
}
#services-grid .service.lorange .title span{ /* Give background color only to the span */
background-color:#efbd00;
}
#services-grid .service.lorange:hover{ /* fade color to container only when hovered */
background:#efbd00;
}
#services-grid .service .title {
position:static; /* This is what's doing the trick */
padding-top:130px; /* position the span using padding instead of position:absolute */
font-size:13pt;
text-align:center;
}
" border-radius
on the child" 解决方案只是一个装饰性的快速修复,可能会导致不一致,并且由于半径差异,它还会在每一侧造成小颠簸: