网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

怎么用纯CSS实现蚊香燃烧的效果

小编给大家分享一下怎么用纯CSS实现蚊香燃烧的效果,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!

站在用户的角度思考问题,与客户深入沟通,找到江山网站设计与江山网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:网站设计、做网站、企业官网、英文网站、手机端网站、网站推广、域名注册网站空间、企业邮箱。业务覆盖江山地区。

    代码解读

    定义dom,容器中包含8个子元素:

   

   

   

   

   

   

   

   

   

   

    居中显示:

    body{

    margin:0;

    height:100vh;

    display:flex;

    align-items:center;

    justify-content:center;

    background:radial-gradient(circleatcenter,midnightblue,black);

    }

    画出纹香盘要用的框线:

    .coil{

    position:relative;

    display:flex;

    justify-content:center;

    }

    .coilspan{

    position:absolute;

    width:calc((var(--n)*2-1)*1em);

    height:calc((var(--n)-0.5)*1em);

    border:1emsoliddarkgreen;

    }

    .coilspan:nth-child(1){

    --n:1;

    }

    .coilspan:nth-child(2){

    --n:2;

    }

    .coilspan:nth-child(3){

    --n:3;

    }

    .coilspan:nth-child(4){

    --n:4;

    }

    .coilspan:nth-child(5){

    --n:5;

    }

    .coilspan:nth-child(6){

    --n:6;

    }

    .coilspan:nth-child(7){

    --n:7;

    }

    .coilspan:nth-child(8){

    --n:8;

    }

    把一半框线放置到上方:

    .coilspan:nth-child(odd){

    align-self:flex-end;

    }

    删除掉上方框线的下边框,和下方框线的上边框:

    .coilspan:nth-child(odd){

    border-bottom:none;

    }

    .coilspan:nth-child(even){

    border-top:none;

    }

    对齐上下边框:

    .coilspan:nth-child(even){

    transform:translateX(-1em);

    }

    把边框改为曲线:

    .coilspan:nth-child(odd){

    border-radius:50%50%00/100%100%00;

    }

    .coilspan:nth-child(even){

    border-radius:0050%50%/00100%100%;

    }

    用伪元素画出蚊香最中间的部分:

    .coil::before{

    content:'';

    position:absolute;

    width:1em;

    height:1em;

    background-color:darkgreen;

    border-radius:50%;

    left:-1.5em;

    top:-0.5em;

    }

    用伪元素画出蚊香的燃点:

    .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:001emwhite;

    }

    最后,为燃点增加闪动的效果:

    .coil::after{

    animation:blink1slinearinfinitealternate;

    }

    @keyframesblink{

    to{

    box-shadow:000white;

    }

    }

看完了这篇文章,相信你对“怎么用纯CSS实现蚊香燃烧的效果”有了一定的了解,如果想了解更多相关知识,欢迎关注创新互联行业资讯频道,感谢各位的阅读!


本文题目:怎么用纯CSS实现蚊香燃烧的效果
文章分享:http://bjjierui.cn/article/piihod.html

其他资讯