国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 宝应县| 太湖县| 资中县| 荃湾区| 永定县| 屏东市| 鸡泽县| 临颍县| 延安市| 孟津县| 垦利县| 吉木萨尔县| 隆安县| 甘泉县| 清丰县| 盱眙县| 昌宁县| 濉溪县| 城步| 章丘市| 涿鹿县| 武汉市| 呼图壁县| 临沭县| 扶风县| 赤峰市| 扎鲁特旗| 亚东县| 博乐市| 鹤壁市| 保康县| 昌平区| 米林县| 武宁县| 武清区| 河间市| 墨竹工卡县| 株洲县| 益阳市| 榆树市| 依安县|