成人国产在线小视频_日韩寡妇人妻调教在线播放_色成人www永久在线观看_2018国产精品久久_亚洲欧美高清在线30p_亚洲少妇综合一区_黄色在线播放国产_亚洲另类技巧小说校园_国产主播xx日韩_a级毛片在线免费

資訊專欄INFORMATION COLUMN

css繪制各種形狀圖形(第二版)

yibinnn / 1071人閱讀

摘要:雖然我們現(xiàn)在大都使用字體圖標(biāo)或者圖片,似乎使用來做圖標(biāo)意義不是很大,但怎么實(shí)現(xiàn)這些圖標(biāo)用到的一些技巧及思路是很值得我們的學(xué)習(xí)。

雖然我們現(xiàn)在大都使用字體圖標(biāo)或者svg圖片,似乎使用 CSS 來做圖標(biāo)意義不是很大,但怎么實(shí)現(xiàn)這些圖標(biāo)用到的一些技巧及思路是很值得我們的學(xué)習(xí)。
一、實(shí)心圓

.circle {
    width: 120px;
    height: 120px;
    background: #8BC34A;
    border-radius: 100%;
}
二、圓環(huán)(空心圓)

.ring {
    width: 100px;
    height: 100px;
    border: 10px solid #8BC34A;
    border-radius: 100%;
}
三、橢圓

.ellipsis {
    width: 200px;
    height: 120px;
    background: #8BC34A;
    border-radius: 100px/60px;
}
四、半圓

.top-semicircle {
    width: 120px;
    height: 60px;
    background: #8BC34A;
    border-radius: 60px 60px 0px 0px;
}

.right-semicircle {
    width: 60px;
    height: 120px;
    background: #8BC34A;
    border-radius: 0 60px 60px 0;
}

.bottom-semicircle {
    width: 120px;
    height: 60px;
    background: #8BC34A;
    border-radius: 0 0 60px 60px;
}

.left-semicircle {
    width: 60px;
    height: 120px;
    background: #8BC34A;
    border-radius: 60px 0 0 60px;
}
五、四分之一圓(扇形)

.toplf-sector,
.toprt-sector,
.bottomlf-sector,
.bottomrt-sector {
    width: 60px;
    height: 60px;
    background: #8BC34A;
}

.toplf-sector {
    border-radius: 60px 0 0 0;
}

.toprt-sector {
    border-radius: 0 60px 0 0;
}

.bottomlf-sector {
    border-radius: 0 0 0 60px;
}

.bottomrt-sector {
    border-radius: 0 0 60px 0;
}
六、心形

.heart-shaped {
    width: 80px;
    height: 80px;
    background: #8BC34A;
    position: relative;
    transform: rotate(45deg);
}

.heart-shaped::before {
    content: "";
    width: 40px;
    height: 80px;
    background: #8BC34A;
    border-radius: 40px 0 0 40px;
    position: absolute;
    right: 99%;
    top: 0;
}

.heart-shaped::after {
    content: "";
    width: 80px;
    height: 40px;
    background: #8BC34A;
    border-radius: 40px 40px 0 0;
    position: absolute;
    left: 0;
    bottom: 99%;
}
七、雞蛋

.egg {
    width: 150px;
    height: 200px;
    background: #8BC34A;
    border-radius: 75px 75px 75px 75px / 130px 130px 70px 70px;
}
八、太極八卦陣圖

.taiji {
    width: 140px;
    height: 70px;
    border: 2px solid #8BC34A;
    border-bottom: 70px solid #8BC34A;
    border-radius: 100%;
    position: relative;
}

.taiji::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 20px;
    height: 20px;
    background: #fff;
    border: 25px solid #8BC34A;
    border-radius: 100%;
}

.taiji::after {
    content: "";
    position: absolute;
    right: 0;
    top: 50%;
    width: 20px;
    height: 20px;
    background: #8BC34A;
    border: 25px solid #fff;
    border-radius: 100%;
}
九、葉子(花瓣)

.leaf1 {
    width: 80px;
    height: 80px;
    background: #8BC34A;
    border-radius: 0 80px;
}

.leaf2 {
    width: 80px;
    height: 80px;
    background: #8BC34A;
    border-radius: 40px 40px 0 40px;
}
十、五葉花瓣

.five-flower {
    position: relative;
    width: 300px;
    height: 280px;
}

.five-flower .petal {
    display: block;
    width: 120px;
    height: 120px;
    background: #8BC34A;
    border-radius: 0 120px;
    position: absolute;
    transform-origin: 100% 100%;
}

.five-flower .petal1 {
    transform: rotate(72deg);
}

.five-flower .petal2 {
    transform: rotate(144deg);
}

.five-flower .petal3 {
    transform: rotate(216deg);
}

.five-flower .petal4 {
    transform: rotate(288deg);
}
十一、牽牛花

.qiannuhua {
    position: relative;
    width: 200px;
    height: 200px;
    margin-left: 140px;
}

.qiannuhua .petal {
    display: block;
    width: 120px;
    height: 120px;
    background: #8BC34A;
    border-radius: 0 120px;
    position: absolute;
    transform-origin: 0% 100%
}

.qiannuhua .petal1 {
    transform: rotate(72deg);
}

.qiannuhua .petal2 {
    transform: rotate(144deg);
}

.qiannuhua .petal3 {
    transform: rotate(216deg);
}

.qiannuhua .petal4 {
    transform: rotate(288deg);
}
十二、風(fēng)車

.fengche {
    position: relative;
    width: 200px;
    height: 200px;
}

.fengche .petal {
    display: block;
    width: 120px;
    height: 120px;
    background: #8BC34A;
    border-radius: 0 120px;
    position: absolute;
    transform-origin: 30% 100%
}

.fengche .petal1 {
    transform: rotate(72deg);
}

.fengche .petal2 {
    transform: rotate(144deg);
}

.fengche .petal3 {
    transform: rotate(216deg);
}

.fengche .petal4 {
    transform: rotate(288deg);
}
十四、小尾巴

.xwb1 {
    width: 20px;
    height: 30px;
    border-left: 8px solid #8BC34A;
    border-radius: 30px 0 0 0;
}
十五、箭頭

.xwb2 {
    width: 0;
    height: 0;
    border-bottom: 10px solid #8BC34A;
    border-left: 10px solid transparent;
    position: relative;
    transform: rotate(8deg);
}

.xwb2::after {
    content: "";
    width: 20px;
    height: 18px;
    border-right: 5px solid #8BC34A;
    border-radius: 0px 40px 0 0;
    position: absolute;
    left: -30px;
    bottom: -15px;
    transform: rotate(-45deg);
}
十六、月亮

.moon {
    width: 80px;
    height: 120px;
    border-left: 40px solid #8BC34A;
    border-radius: 60px;
}
十六、三角形

.triangle-bot {
    width: 0;
    height: 0;
    border: 40px solid transparent;
    border-bottom-color: #8BC34A;
}

.triangle-top {
    width: 0;
    height: 0;
    border: 40px solid transparent;
    border-top-color: #8BC34A;
}

.triangle-lf {
    width: 0;
    height: 0;
    border: 40px solid transparent;
    border-left-color: #8BC34A;
}

.triangle-rt {
    width: 0;
    height: 0;
    border: 40px solid transparent;
    border-right-color: #8BC34A;
}

.triangle-toplf,
.triangle-toprt,
.triangle-bottomlf,
.triangle-bottomrt {
    width: 0;
    height: 0;
}

.triangle-toplf {
    border-top: 120px solid #8BC34A;
    border-right: 120px solid transparent;
}

.triangle-toprt {
    border-top: 120px solid #8BC34A;
    border-left: 120px solid transparent;
}

.triangle-bottomlf {
    border-bottom: 120px solid #8BC34A;
    border-right: 120px solid transparent;
}

.triangle-bottomrt {
    border-bottom: 120px solid #8BC34A;
    border-left: 120px solid transparent;
}

.triangle1 {
    border-bottom: 120px solid #8BC34A;
    border-right: 60px solid transparent;
}

.triangle2 {
    border-top: 120px solid #8BC34A;
    border-left: 60px solid transparent;
}

.triangle3 {
    border-top: 60px solid #8BC34A;
    border-right: 120px solid transparent;
}

.triangle4 {
    border-top: 60px solid #8BC34A;
    border-left: 120px solid transparent;
}

.triangle5 {
    border-top: 80px solid #8BC34A;
    border-left: 40px solid transparent;
    border-right: 40px solid transparent;
}
十七、梯形

.tixing1 {
    border-bottom: 100px solid #8BC34A;
    border-left: 60px solid transparent;
    border-right: 60px solid transparent;
    width: 100px;
    height: 0;
}

.tixing2 {
    border-bottom: 120px solid #8BC34A;
    border-right: 120px solid transparent;
    width: 80px;
}
十八、邊框?qū)υ捒?/b>

.duihuakuang {
    width: 200px;
    height: 100px;
    border: 2px solid #8BC34A;
    border-radius: 6px;
    position: relative;
}

.duihuakuang::before {
    content: "";
    width: 20px;
    height: 20px;
    background: #fff;
    border-right: 2px solid #8BC34A;
    border-bottom: 2px solid #8BC34A;
    position: absolute;
    left: 30%;
    top: 100%;
    transform: rotate(45deg);
    margin-top: -10px;
}
十九、鎖

.suo {
    width: 200px;
    height: 160px;
    background: #8BC34A;
    border-radius: 30px;
    position: relative;
}
/*鎖孔*/
.suo::before {
    content: "";
    width: 25px;
    height: 50px;
    background: #fff;
    position: absolute;
    left: 50%;
    top: 50%;
    border-radius: 25px;
    transform: translate(-50%, -50%);
}
/*鎖把*/
.suo::after {
    content: "";
    width: 80px;
    height: 70px;
    border: 20px solid #8BC34A;
    background: #fff;
    border-radius: 60px 60px 0 0;
    position: absolute;
    left: 50%;
    bottom: 89%;
    transform: translateX(-50%);
}
二十、立體球型

.qiu1 {
    width: 120px;
    height: 120px;
    background: #8BC34A;
    background-image: radial-gradient(at 20% 30%, #e5ffc7, #75af33, #375f0a);
    border-radius: 100%;
}
二十一、圓柱

 
.cylinder {
    position: relative;
    transform: rotateX(70deg);
}

.ellipse {
    width: 100px;
    height: 100px;
    background: deepskyblue;
    border-radius: 50px;
}

.rectangle {
    width: 100px;
    height: 400px;
    position: absolute;
    opacity: 0.6;
    background: deepskyblue;
    top: 0;
    left: 0;
    border-radius: 50px;
    z-index: -1;
}

更多形狀圖形持續(xù)更新,歡迎大家討論提出問題
(CSS漸變繪制切角效果)

參考文章:
http://www.imooc.com/article/...

文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請(qǐng)注明本文地址:http://systransis.cn/yun/53923.html

相關(guān)文章

  • css繪制各種形狀圖形二版

    摘要:雖然我們現(xiàn)在大都使用字體圖標(biāo)或者圖片,似乎使用來做圖標(biāo)意義不是很大,但怎么實(shí)現(xiàn)這些圖標(biāo)用到的一些技巧及思路是很值得我們的學(xué)習(xí)。 雖然我們現(xiàn)在大都使用字體圖標(biāo)或者svg圖片,似乎使用 CSS 來做圖標(biāo)意義不是很大,但怎么實(shí)現(xiàn)這些圖標(biāo)用到的一些技巧及思路是很值得我們的學(xué)習(xí)。 一、實(shí)心圓 showImg(https://segmentfault.com/img/bVbsV6v?w=171&h...

    CoreDump 評(píng)論0 收藏0
  • 翻譯 | 編寫SVG的口袋指南(上)

    摘要:元素元素歸屬于容器和結(jié)構(gòu)元素,在文檔內(nèi)允許嵌套使用獨(dú)立的片段。如果包含葡萄的組被移動(dòng)到文檔的末尾,它將出現(xiàn)在西瓜的前面。例如,將葡萄的莖的路徑移動(dòng)到組的末尾將導(dǎo)致莖在頂部。 作者:DDU(滬江前端開發(fā)工程師)本文是原文翻譯,轉(zhuǎn)載請(qǐng)注明作者及出處。 簡介 Scalable Vector Graphics (SVG)是在XML中描述二維圖形的語言。這些圖形由路徑,圖片和(或)文本組成,并能...

    Brenner 評(píng)論0 收藏0
  • 翻譯 | 編寫SVG的口袋指南(上)

    摘要:元素元素歸屬于容器和結(jié)構(gòu)元素,在文檔內(nèi)允許嵌套使用獨(dú)立的片段。如果包含葡萄的組被移動(dòng)到文檔的末尾,它將出現(xiàn)在西瓜的前面。例如,將葡萄的莖的路徑移動(dòng)到組的末尾將導(dǎo)致莖在頂部。 作者:DDU(滬江前端開發(fā)工程師)本文是原文翻譯,轉(zhuǎn)載請(qǐng)注明作者及出處。 簡介 Scalable Vector Graphics (SVG)是在XML中描述二維圖形的語言。這些圖形由路徑,圖片和(或)文本組成,并能...

    linkFly 評(píng)論0 收藏0
  • css繪制各種各樣的形狀圖形

    摘要:我們在編寫前端代碼時(shí),經(jīng)常會(huì)遇到各種各樣的形狀圖形如邊框?qū)υ捒?,三角形,平行四邊形圓角邊框圓形四葉草花瓣等,除了用背景圖片雪碧圖或精靈圖定位引用和插入圖片的方法,我們還可以用邊框圓角漸變和定位的方法結(jié)合使用,繪制各種各樣的形狀圖形。 我們在編寫前端代碼時(shí),經(jīng)常會(huì)遇到各種各樣的形狀圖形(如:邊框?qū)υ捒?,三角形,平行四邊形、圓角邊框、圓形、四葉草、花瓣等),除了用背景圖片(css雪碧圖或c...

    mingde 評(píng)論0 收藏0

發(fā)表評(píng)論

0條評(píng)論

最新活動(dòng)
閱讀需要支付1元查看
<