<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問答1問答10問答100問答1000問答2000關(guān)鍵字專題1關(guān)鍵字專題50關(guān)鍵字專題500關(guān)鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關(guān)鍵字專題關(guān)鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
        當(dāng)前位置: 首頁 - 科技 - 知識百科 - 正文

        如何使用純CSS實(shí)現(xiàn)蚊香燃燒的效果(附源碼)

        來源:懂視網(wǎng) 責(zé)編:小采 時間:2020-11-02 22:08:08
        文檔

        如何使用純CSS實(shí)現(xiàn)蚊香燃燒的效果(附源碼)

        如何使用純CSS實(shí)現(xiàn)蚊香燃燒的效果(附源碼):本篇文章給大家?guī)淼膬?nèi)容是關(guān)于如何使用純CSS實(shí)現(xiàn)傳統(tǒng)蚊香燃燒的效果(附源碼),有一定的參考價值,有需要的朋友可以參考一下,希望對你有所幫助。效果預(yù)覽源代碼下載每日前端實(shí)戰(zhàn)系列的全部源代碼請從 github 下載:https://github.com/comeho
        推薦度:
        導(dǎo)讀如何使用純CSS實(shí)現(xiàn)蚊香燃燒的效果(附源碼):本篇文章給大家?guī)淼膬?nèi)容是關(guān)于如何使用純CSS實(shí)現(xiàn)傳統(tǒng)蚊香燃燒的效果(附源碼),有一定的參考價值,有需要的朋友可以參考一下,希望對你有所幫助。效果預(yù)覽源代碼下載每日前端實(shí)戰(zhàn)系列的全部源代碼請從 github 下載:https://github.com/comeho
        本篇文章給大家?guī)淼膬?nèi)容是關(guān)于如何使用純CSS實(shí)現(xiàn)傳統(tǒng)蚊香燃燒的效果(附源碼),有一定的參考價值,有需要的朋友可以參考一下,希望對你有所幫助。

        效果預(yù)覽

        3235001503-5b1ddfb66be51_articlex.png

        源代碼下載

        每日前端實(shí)戰(zhàn)系列的全部源代碼請從 github 下載:

        https://github.com/comehope/front-end-daily-challenges

        代碼解讀

        定義 dom,容器中包含 8 個子元素:

        <div class="coil">
         <span></span>
         <span></span>
         <span></span>
         <span></span>
         <span></span>
         <span></span>
         <span></span>
         <span></span>
        </div>

        居中顯示:

        body {
         margin: 0;
         height: 100vh;
         display: flex;
         align-items: center;
         justify-content: center;
         background: radial-gradient(circle at center, midnightblue, black);
        }

        畫出紋香盤要用的框線:

        .coil {
         position: relative;
         display: flex;
         justify-content: center;
        }
        
        .coil span {
         position: absolute;
         width: calc((var(--n) * 2 - 1) * 1em);
         height: calc((var(--n) - 0.5) * 1em);
         border: 1em solid darkgreen;
        }
        
        .coil span:nth-child(1) {
         --n: 1;
        }
        
        .coil span:nth-child(2) {
         --n: 2;
        }
        
        .coil span:nth-child(3) {
         --n: 3;
        }
        
        .coil span:nth-child(4) {
         --n: 4;
        }
        
        .coil span:nth-child(5) {
         --n: 5;
        }
        
        .coil span:nth-child(6) {
         --n: 6;
        }
        
        .coil span:nth-child(7) {
         --n: 7;
        }
        
        .coil span:nth-child(8) {
         --n: 8;
        }

        把一半框線放置到上方:

        .coil span:nth-child(odd) {
         align-self: flex-end;
        }

        刪除掉上方框線的下邊框,和下方框線的上邊框:

        .coil span:nth-child(odd) {
         border-bottom: none;
        }
        
        .coil span:nth-child(even) {
         border-top: none;
        }

        對齊上下邊框:

        .coil span:nth-child(even) {
         transform: translateX(-1em);
        }

        把邊框改為曲線:

        .coil span:nth-child(odd) {
         border-radius: 50% 50% 0 0 / 100% 100% 0 0;
        }
        
        .coil span:nth-child(even) {
         border-radius: 0 0 50% 50% / 0 0 100% 100%;
        }

        用偽元素畫出蚊香最中間的部分:

        .coil::before {
         content: '';
         position: absolute;
         width: 1em;
         height: 1em;
         background-color: darkgreen;
         border-radius: 50%;
         left: -1.5em;
         top: -0.5em;
        }

        用偽元素畫出蚊香的燃點(diǎn):

        .coil::after {
         content: '';
         position: absolute;
         width: 1em;
         height: 1em;
         border-radius: 50%;
         top: -0.5em;
         background-color: darkred;
         left: -9.5em;
         z-index: -1;
         transform: scale(0.9);
         box-shadow: 0 0 1em white;
        }

        最后,為燃點(diǎn)增加閃動的效果:

        .coil::after {
         animation: blink 1s linear infinite alternate;
        }
        
        @keyframes blink {
         to {
         box-shadow: 0 0 0 white;
         }
        }

        大功告成!

        聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        如何使用純CSS實(shí)現(xiàn)蚊香燃燒的效果(附源碼)

        如何使用純CSS實(shí)現(xiàn)蚊香燃燒的效果(附源碼):本篇文章給大家?guī)淼膬?nèi)容是關(guān)于如何使用純CSS實(shí)現(xiàn)傳統(tǒng)蚊香燃燒的效果(附源碼),有一定的參考價值,有需要的朋友可以參考一下,希望對你有所幫助。效果預(yù)覽源代碼下載每日前端實(shí)戰(zhàn)系列的全部源代碼請從 github 下載:https://github.com/comeho
        推薦度:
        標(biāo)簽: flex 燃燒 實(shí)現(xiàn)
        • 熱門焦點(diǎn)

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 亚洲精彩视频在线观看| 亚洲人成人无码网www电影首页 | 午夜亚洲av永久无码精品| 亚洲AV日韩综合一区尤物| 精品国产sm捆绑最大网免费站 | 四虎成人免费大片在线| 亚洲国产日韩精品| 精品久久久久国产免费| 亚洲中文字幕无码中文字| 免费毛片在线视频| 国产精品亚洲精品爽爽| 亚洲日韩VA无码中文字幕| a级毛片黄免费a级毛片| 99人中文字幕亚洲区| 黄页网站在线观看免费高清| 国产精品亚洲综合久久| 国产免费资源高清小视频在线观看| 色网站在线免费观看| 亚洲国产精品VA在线观看麻豆| 91禁漫免费进入| 亚洲已满18点击进入在线观看| 国产免费资源高清小视频在线观看| 国产精品免费观看视频| 亚洲ⅴ国产v天堂a无码二区| 欧洲精品成人免费视频在线观看 | 亚洲熟妇久久精品| 亚洲精品国产电影| 国产精品白浆在线观看免费| 亚洲成a人片在线看| 免费一级毛片免费播放| 青青草原1769久久免费播放 | 一级做a免费视频观看网站| 亚洲今日精彩视频| 高清国语自产拍免费视频国产| 一区二区三区免费在线视频| 亚洲bt加勒比一区二区| 国产精品四虎在线观看免费 | 亚洲精品国产成人99久久| 免费特级黄毛片在线成人观看| 一级毛片aaaaaa视频免费看| 亚洲福利一区二区精品秒拍|