Hole in overlay with CSS

前端 未结 6 953
清酒与你
清酒与你 2020-11-30 13:46

How is it possible to create a hole in an overlay where you can see through to the actual website?

6条回答
  •  没有蜡笔的小新
    2020-11-30 14:06

    You can now achieve this with relatively good support in new webkit browsers using css clipping (see here for compatability).

    For example, the following code would cut a hole with a radius of 100px (so 200px wide) in the center of your element (with a slightly feathered edge).

    -webkit-mask-image radial-gradient(100px at 50% 50% , transparent 95%, black 100%)
    

    Here's a codepen to demonstrate.

提交回复
热议问题