国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > CSS > 正文

實(shí)現(xiàn)CSS圓環(huán)的5種方法(小結(jié))

2024-07-11 08:59:23
字體:
供稿:網(wǎng)友

想到去年面試實(shí)習(xí)的時候被問到實(shí)習(xí)圓環(huán)的問題,特意寫篇文章總結(jié)一下吧!總結(jié)了一下大概有5種方法。


 

1. 兩個標(biāo)簽的嵌套:

<div class="element1">    <div class="child1"></div></div>
.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

<div class="element2"></div>
.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:

<div class="element3"></div>
 .element3{            width: 100px;            height: 100px;            background-color: #009966;            border-radius: 50%;            border: 50px solid lightpink ;        }

4. 使用border-shadow

<div class="element4"></div>
.element4{            width: 100px;            height: 100px;            background-color: #009966;            border-radius: 50%;            box-shadow: 0 0 0 50px lightpink ;            margin: auto;        }
<div 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

<div class="element6"></div>
.element6{            width: 200px;            height: 200px;            border-radius: 50%;            background: -webkit-radial-gradient( circle closest-side,#009966 50%,lightpink 50%);        }

如果大家有其他的方法,請告訴我吧,謝謝!!!

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持武林網(wǎng)。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 和政县| 辰溪县| 云安县| 江孜县| 镇平县| 奉新县| 邵阳市| 绥中县| 河西区| 罗山县| 广宁县| 习水县| 建湖县| 南部县| 林芝县| 卓尼县| 易门县| 上虞市| 上犹县| 滕州市| 利川市| 调兵山市| 睢宁县| 宣汉县| 视频| 平顶山市| 通化市| 金川县| 科技| 西盟| 社旗县| 岳阳市| 邵阳市| 南乐县| 德兴市| 平乡县| 蓝山县| 泊头市| 龙州县| 基隆市| 灵武市|