<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
        主站蜘蛛池模板: 校园亚洲春色另类小说合集| 国产午夜亚洲精品| 国产精品极品美女自在线观看免费 | 亚洲国产一区国产亚洲| 久久美女网站免费| 亚洲国产精品成人久久| 国内精品久久久久影院免费| 亚洲s色大片在线观看| 日韩精品人妻系列无码专区免费| 亚洲国产精品自在在线观看| 黄+色+性+人免费| 亚洲一区二区久久| 日本大片在线看黄a∨免费| 免费无码一区二区| 亚洲情XO亚洲色XO无码| 黄+色+性+人免费| 亚洲国产综合AV在线观看| 免费播放特黄特色毛片| 中文字幕在线免费播放| 一区二区三区亚洲| 啦啦啦在线免费视频| 免费的黄色的网站| 亚洲av无码一区二区三区不卡| 日韩在线播放全免费| 国产亚洲视频在线观看网址| 亚洲人色婷婷成人网站在线观看| 亚洲免费视频播放| 亚洲AV成人一区二区三区观看| 中文字幕精品亚洲无线码一区应用| 3d成人免费动漫在线观看| 风间由美在线亚洲一区| 人人狠狠综合久久亚洲88| 青苹果乐园免费高清在线| 亚洲阿v天堂在线2017免费 | 1000部羞羞禁止免费观看视频| 亚洲中文字幕无码久久| 亚洲国产日韩在线视频| 最近中文字幕无免费视频| 久久性生大片免费观看性| 亚洲AV男人的天堂在线观看| 亚洲日韩精品无码专区网址|