How to make CSS3 rounded corners hide overflow in Chrome/Opera

后端 未结 13 2277
无人及你
无人及你 2020-11-22 09:10

I need round corners on a parent div to mask content from its childen. overflow: hidden works in simple situations, but breaks in webkit based browsers and Oper

13条回答
  •  面向向阳花
    2020-11-22 09:50

    based on graycrow's excellent answer...

    Here's a more real world example that has two cicular divs with some filler content. I replaced the hard-coded png background with just a hex value, i.e.

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

    is replaced with

    -webkit-mask-image:#fff;
    

    See this JSFiddle... http://jsfiddle.net/hqLkA/

提交回复
热议问题