Webkit边界半径结合css3 translate3D出血 [英] Webkit border radius combined with css3 translate3D bleeding

查看:173
本文介绍了Webkit边界半径结合css3 translate3D出血的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个问题上的基于WebKit浏览器在那里,如果我边框半径增加一个div,然后应用-moz-translate3d到UL内(这是因为在原来的例子中,我使用flexslider幻灯片)挣扎,边界半径不适用,并通过容器渗出。

I'm struggling with a problem on Webkit based browsers where if I add a border radius to a div and then apply -moz-translate3d to a ul inside (this is because on the original example I'm using flexslider slideshow), the border radius does not apply and bleeds through the container.

要清楚地了解我在说什么是一个关于这个问题的例子。如果我删除了translate3d属性,则应用边框半径。

To clearly understand what I'm talking about here's a fiddle example about the problem. If I remove the translate3d property, the border radius is applied.

HTML:

<div class="wrapper">
    <ul>
        <li>
            <div class="caption"><p>Test</p></div>
        </li>
        <li>
            <div class="caption"><p>Test</p></div>
        </li>
        <li>
            <div class="caption"><p>Test</p></div>
        </li>
        <li>
            <div class="caption"><p>Test</p></div>
        </li>
    </ul>
</div>

CSS:

.wrapper {
    border-radius: 20px;
    position: relative;
    width: 500px;
    height: 200px;
    overflow: hidden;
}

.caption {
    position: absolute;
    bottom: 0;
    left: 0;
    background-color: rgba(0,0,0,0.8);
    padding: 2rem;
    -webkit-box-sizing: border-box;
    width: 100%;
    height: 3rem;
    color: #fff;
}

ul {
    width: 800%;
    -webkit-transform: translate3d(-500px, 0, 0); 
}

li {
    float: left;
    width: 500px;
    height: 200px;
    background-color: #000;
    position: relative;
}

.caption p {
    color: #fff;
}

http://jsfiddle.net/R5L3K/12/

测试了两种在Mac和Windows的Chrome最新版本。

Tested it both on Chrome latest version on Mac and Windows.

提前感谢!

推荐答案

我已经回答了这个问题。

I have answered this question before. It is a webkit bug.

将此代码添加到您添加边框半径的同一个选择器

Add this code to the same selector you are adding border radius too

-webkit-mask-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAA5JREFUeNpiYGBgAAgwAAAEAAGbA+oJAAAAAElFTkSuQmCC);

http://jsfiddle.net/R5L3K/14/

旧的答案来源
flexslider边界半径不换形象Chrome,Safari,但会在Firefox

这篇关于Webkit边界半径结合css3 translate3D出血的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆