सबसे आसान तरीका अतिप्रवाह छिपा (ग्रे एक)
अंदर से के साथ एक पारदर्शी DIV उपयोग करने के लिए बस बहुत बड़ी प्रसार के साथ बॉक्स-छाया के साथ एक चक्र डाल है।
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>
आप ऊपर मैं :after
छद्म तत्व है जो (अतिव्यापी छद्म तत्व के कारण) .hasCircle
में कुछ पाठ को रोकने दिखाई दे सकता है हो सकता है का उपयोग किया है देख सकते हैं, लेकिन यह सिर्फ करने के लिए एक विचार प्राप्त करें, आप इसे वास्तविक तत्व का उपयोग करके कर सकते हैं जैसे:
<div class="boxTransparentOverflow">
<div class="theTransparentCircleWithGraySpread"></div>
Some text
</div>
स्रोत
2014-10-30 14:03:10
सबसे आसान तरीका केवल एक पीएनजी बनाना होगा। – cport1
http://stackoverflow.com/questions/22332755/build-a-rectangle-frame-with-a-transparent-circle-using-css-only – eclipsis