Webkit not respecting overflow:hidden with border radius

前端 未结 8 1650
抹茶落季
抹茶落季 2020-12-09 17:03

I have a lovely Star Trek Red Alert animation using CSS3. One of my parent elements has a border-radius along with overflow:hidden so that any con

相关标签:
8条回答
  • 2020-12-09 17:56

    Just as a heads up, this fix only worked for me if I applied the mask on a container with border-radius, but no border. Ultimately I ended up with something like this:

    <div style="border-radius: 15px; border: 1px solid red;">
        <div style="border-radius: 15px; overflow: hidden; -webkit-mask-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAA5JREFUeNpiYGBgAAgwAAAEAAGbA+oJAAAAAElFTkSuQmCC);">
            <span style="position: relative; left; -20px;">Some stuff that overflows.</span>
        </div>
    </div>
    

    With a border on the inner div, the clipping wasn't perfect.

    Totally weird.

    0 讨论(0)
  • 2020-12-09 17:58

    You could put an absolute positioned div over it with a border-radius and a thick black border, it will block the parts you want too be hidden.

    I made a demo for another question about a similar problem in FF3.6: http://jsfiddle.net/vfp3v/15/

    border-radius; overflow: hidden, and text is not clipped

    0 讨论(0)
提交回复
热议问题