最简单的方法是使用透明 DIV与溢出隐藏(灰色之一)
比里面简单地说用的box-shadow一个圆圈,真正的大蔓延。
html, body{height:100%;}
body{
background: url(http://web-vassets.ea.com/Assets/Richmedia/Image/Screenshots/FIFA-Street-London1web.jpg?cb=1330546446) 50%/cover;
}
.hasCircle{
width:150px;
height:300px;
position:relative;
overflow:hidden;
float:left;
}
.hasCircle:after{
content:" ";
position:absolute;
left:0; right:0;
margin:100px auto;
width:100px;
height:100px;
border-radius:50%;
box-shadow: 0 0 0 1000px #444;
}
<div class="hasCircle"></div>
<div class="hasCircle"></div>
<div class="hasCircle"></div>
正如你可以在上面看到我用这可能会导致一些文本中.hasCircle
可见(由于重叠伪元素)的:after
伪元素,但它只是得到一个想法,你可以使用像这样的一个真实的元素:
<div class="boxTransparentOverflow">
<div class="theTransparentCircleWithGraySpread"></div>
Some text
</div>
最简单的方法是只是一个PNG。 – cport1 2014-10-30 13:50:41
http://stackoverflow.com/questions/22332755/build-a-rectangle-frame-with-a-transparent-circle-using-css-only – eclipsis 2014-10-30 13:52:18