如何在CSS中创建一个反透明圆 [英] How to make an inverse transparent circle in CSS
本文介绍了如何在CSS中创建一个反透明圆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使一个部分的颜色背景透明与css?
这里是此背景的示例
how do i make a section on color background transparent with css? here is example for this background
我仍然没有尝试任何因为我不知道如何做到这一点,请帮助我。
如果将其div作为div并输入css:
i still didn't try anything becouse i have no idea how to do that so please help me. if im putting its as div on div and typing in the css:
.Xclass{ background: transparent; }
它仍然显示白色背景。
请帮助我。
推荐答案
jsBin demo
- 放置
。
- 在这个方块内放置
- Place an
overflow:hidden
square with no background. - Inside that square - put a circle with a high
box-shadow
spread radius
#image{
position:relative;
margin:0 auto;
background: url(http://i.imgur.com/gVcxX9C.png);
height:500px;
width:600px;
}
#box{
position:absolute;
left:300px;
top:200px;
width:200px;
height:250px;
overflow:hidden; /* to contain #circle's box-shadow */
}
#circle{
position:relative;
margin:30px auto;
width: 150px;
height:150px;
box-shadow: 0 0 0 100px #fff; /* !!! */
border-radius:50%;
}
<div id="image">
<div id="box"><div id="circle"></div></div>
</div>
这篇关于如何在CSS中创建一个反透明圆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文