小編給大家分享一下實現(xiàn)CSS圓環(huán)的方法有哪些,希望大家閱讀完這篇文章后大所收獲,下面讓我們一起去探討吧!
1. 兩個標(biāo)簽的嵌套:
<p class="element1"> <p class="child1"></p> </p>
.element1{ width: 200px; height: 200px; background-color: lightpink; border-radius: 50%; } .child1{ width: 100px; height: 100px; border-radius: 50%; background-color: #009966; position: relative; top: 50px; left: 50px; }
2. 使用偽元素,before/after
<p class="element2"></p>
.element2{ width: 200px; height: 200px; background-color: lightpink; border-radius: 50%; } .element2:after{ content: ""; display: block; width: 100px; height: 100px; border-radius: 50%; background-color: #009966; position: relative; top: 50px; left: 50px; }
3. 使用border:
<p class="element3"></p>
.element3{ width: 100px; height: 100px; background-color: #009966; border-radius: 50%; border: 50px solid lightpink ; }
4. 使用border-shadow
<p class="element4"></p>
.element4{ width: 100px; height: 100px; background-color: #009966; border-radius: 50%; box-shadow: 0 0 0 50px lightpink ; margin: auto; }
<p class="element5">
.element5{ width: 200px; height: 200px; background-color: #009966; border-radius: 50%; box-shadow: 0 0 0 50px lightpink inset; margin: auto; }
5. 使用radial-gradient
<p class="element6"></p>
.element6{ width: 200px; height: 200px; border-radius: 50%; background: -webkit-radial-gradient( circle closest-side,#009966 50%,lightpink 50%); }
看完了這篇文章,相信你對實現(xiàn)CSS圓環(huán)的方法有哪些有了一定的了解,想了解更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)網(wǎng)站制作公司行業(yè)資訊頻道,感謝各位的閱讀!
新聞標(biāo)題:實現(xiàn)CSS圓環(huán)的方法有哪些-創(chuàng)新互聯(lián)
網(wǎng)站鏈接:http://www.rwnh.cn/article36/pocpg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站收錄、移動網(wǎng)站建設(shè)、外貿(mào)網(wǎng)站建設(shè)、虛擬主機、網(wǎng)站建設(shè)、自適應(yīng)網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)