本文介紹了如何僅使用 CSS 創(chuàng)建一個圓形或方形 - 中心是空心的?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
它應該基本上是正方形或圓形的輪廓 - 我可以相應地設置樣式(即,將顏色更改為我想要的任何顏色,更改邊框的粗細等)
It should just basically be an outline of the square or circle - that I can style accordingly (i.e. change the color to whatever I want, change the thickness of the border, etc.)
我想將那個圓形或正方形應用到其他東西(如圖像或其他東西)上,中間部分應該被挖空,這樣您就可以看到正方形或圓形下方的圖像.
I would like to apply that circle or square over something else (like an image or something) and the middle part should be hollowed out, so you can see the image beneath the square or circle.
我希望它主要是 CSS + HTML.
I would prefer for it to be mainly CSS + HTML.
推薦答案
試試這個
div.circle {
-moz-border-radius: 50px/50px;
-webkit-border-radius: 50px 50px;
border-radius: 50px/50px;
border: solid 21px #f00;
width: 50px;
height: 50px;
}
div.square {
border: solid 21px #f0f;
width: 50px;
height: 50px;
}
<div class="circle">
<img/>
</div>
<hr/>
<div class="square">
<img/>
</div>
更多內(nèi)容
這篇關(guān)于如何僅使用 CSS 創(chuàng)建一個圓形或方形 - 中心是空心的?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!