HTML+CSS制作DNA双螺旋结构

简介: HTML+CSS制作DNA双螺旋结构

HTML+CSS制作DNA双螺旋结构

效果图如下:

HTML部分源代码如下:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>双螺旋结构</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div class="item">
        <div class="line"></div>
    </div>
    <div class="item">
        <div class="line"></div>
    </div>
    <div class="item">
        <div class="line"></div>
    </div>
    <div class="item">
        <div class="line"></div>
    </div>
    <div class="item">
        <div class="line"></div>
    </div>
    <div class="item">
        <div class="line"></div>
    </div>
    <div class="item">
        <div class="line"></div>
    </div>
    <div class="item">
        <div class="line"></div>
    </div>
    <div class="item">
        <div class="line"></div>
    </div>
    <div class="item">
        <div class="line"></div>
    </div>
</body>
</html>

CSS部分源代码如下:

:root {
    --background-color: #2c3e50;
    --line-color: slategray;
}
* {
    margin: 0;
    padding: 0;
}
body {
    width: 100vw;
    height: 100vh;
    background-color: var(--background-color);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}
.item {
    position: relative;
    width: 120px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    /* background-color: cadetblue; */
}
.item .line {
    width: 120px;
    height: 3px;
    background-color: var(--line-color);
    animation: line_width_change 1s linear infinite;
}
@keyframes line_width_change {
    0%, 100% {
        width: 100%;
    }
    50% {
        width: 0%;
    }
}
.item::before, .item::after {
    position: absolute;
    content: "";
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: yellow;
}
.item::before {
    background-color: salmon;
    left: -15px;
    animation: circle_move1 2s linear infinite;
    z-index: 100;
}
.item::after {
    background-color: seagreen;
    right: -15px;
    animation: circle_move2 2s linear infinite;
    z-index: 200;
}
@keyframes circle_move1 {
    0% {
        left: -15px;
        width: 30px;
        height: 30px;
        z-index: 100;
    }
    25% {
        width: 25px;
        height: 25px;
    }
    50% {
        left: 105px;
        width: 30px;
        height: 30px;
    }
    75% {
        width: 35px;
        height: 35px;
    }
    100% {
        left: -15px;
        width: 30px;
        height: 30px;
        z-index: 200;
    }
}
@keyframes circle_move2 {
    0% {
        right: -15px;
        width: 30px;
        height: 30px;
        z-index: 200;
    }
    25% {
        width: 35px;
        height: 35px;
    }
    50% {
        right: 105px;
        width: 30px;
        height: 30px;
    }
    75% {
        width: 25px;
        height: 25px;
    }
    100% {
        right: -15px;
        width: 30px;
        height: 30px;
        z-index: 100;
    }
}
.item:nth-child(1) .line, .item:nth-child(1)::before, .item:nth-child(1)::after {
    animation-delay: 0.1s;
}
.item:nth-child(2) .line, .item:nth-child(2)::before, .item:nth-child(2)::after {
    animation-delay: 0.2s;
}
.item:nth-child(3) .line, .item:nth-child(3)::before, .item:nth-child(3)::after {
    animation-delay: 0.3s;
}
.item:nth-child(4) .line, .item:nth-child(4)::before, .item:nth-child(4)::after {
    animation-delay: 0.4s;
}
.item:nth-child(5) .line, .item:nth-child(5)::before, .item:nth-child(5)::after {
    animation-delay: 0.5s;
}
.item:nth-child(6) .line, .item:nth-child(6)::before, .item:nth-child(6)::after {
    animation-delay: 0.6s;
}
.item:nth-child(7) .line, .item:nth-child(7)::before, .item:nth-child(7)::after {
    animation-delay: 0.7s;
}
.item:nth-child(8) .line, .item:nth-child(8)::before, .item:nth-child(8)::after {
    animation-delay: 0.8s;
}
.item:nth-child(9) .line, .item:nth-child(9)::before, .item:nth-child(9)::after {
    animation-delay: 0.9s;
}
.item:nth-child(10) .line, .item:nth-child(10)::before, .item:nth-child(10)::after {
    animation-delay: 1s;
}


相关文章
|
存储 前端开发 JavaScript
仿真银行app下载安装, 银行卡虚拟余额制作app,用html+css+js实现逼真娱乐工具
这是一个简单的银行账户模拟器项目,用于学习前端开发基础。用户可进行存款、取款操作,所有数据存储于浏览器内存中
|
人工智能 程序员 UED
【01】完成新年倒计时页面-蛇年新年快乐倒计时领取礼物放烟花html代码优雅草科技央千澈写采用html5+div+CSS+JavaScript-优雅草卓伊凡-做一条关于新年的代码分享给你们-为了C站的分拼一下子
【01】完成新年倒计时页面-蛇年新年快乐倒计时领取礼物放烟花html代码优雅草科技央千澈写采用html5+div+CSS+JavaScript-优雅草卓伊凡-做一条关于新年的代码分享给你们-为了C站的分拼一下子
1222 21
【01】完成新年倒计时页面-蛇年新年快乐倒计时领取礼物放烟花html代码优雅草科技央千澈写采用html5+div+CSS+JavaScript-优雅草卓伊凡-做一条关于新年的代码分享给你们-为了C站的分拼一下子
|
前端开发 JavaScript
【02】v1.0.1更新增加倒计时完成后的放烟花页面-优化播放器-优化结构目录-蛇年新年快乐倒计时领取礼物放烟花html代码优雅草科技央千澈写采用html5+div+CSS+JavaScript-优雅草卓伊凡-做一条关于新年的代码分享给你们-为了C站的分拼一下子
【02】v1.0.1更新增加倒计时完成后的放烟花页面-优化播放器-优化结构目录-蛇年新年快乐倒计时领取礼物放烟花html代码优雅草科技央千澈写采用html5+div+CSS+JavaScript-优雅草卓伊凡-做一条关于新年的代码分享给你们-为了C站的分拼一下子
1122 14
【02】v1.0.1更新增加倒计时完成后的放烟花页面-优化播放器-优化结构目录-蛇年新年快乐倒计时领取礼物放烟花html代码优雅草科技央千澈写采用html5+div+CSS+JavaScript-优雅草卓伊凡-做一条关于新年的代码分享给你们-为了C站的分拼一下子
css3 svg制作404页面动画效果HTML源码
css3 svg制作404页面动画效果HTML源码
448 34
|
前端开发
【2025优雅草开源计划进行中01】-针对web前端开发初学者使用-优雅草科技官网-纯静态页面html+css+JavaScript可直接下载使用-开源-首页为优雅草吴银满工程师原创-优雅草卓伊凡发布
【2025优雅草开源计划进行中01】-针对web前端开发初学者使用-优雅草科技官网-纯静态页面html+css+JavaScript可直接下载使用-开源-首页为优雅草吴银满工程师原创-优雅草卓伊凡发布
1547 1
【2025优雅草开源计划进行中01】-针对web前端开发初学者使用-优雅草科技官网-纯静态页面html+css+JavaScript可直接下载使用-开源-首页为优雅草吴银满工程师原创-优雅草卓伊凡发布
html+js+css实现的建筑方块立体数字时钟源码
html+js+css实现的建筑方块立体数字时钟源码
867 33
|
前端开发
“弘五四,耀青春”程序创意获奖作品【html+css】
本作品以“青春筑梦,共创未来”为主题,采用动态龙元素展现青春活力与创新精神。页面设计简洁明快,色彩协调,突显年轻人积极向上的风貌。作品内容包括获奖截图、名字《时代扬新帆》及源代码分享。特别说明:禁止用于商业活动,可用于比赛和作业等开源场景。最后,作者表达了对五四精神的致敬与传承,强调了青春活力和创造力的重要性,并感谢评委和支持者。 **获奖感言摘录:** “获得这个奖项,对我们团队来说,既是认可也是激励。我们将继续努力,不断优化产品,为用户带来更好的体验,为社会贡献更多价值。”
545 2
|
前端开发 JavaScript 搜索推荐
打造个人博客网站:从零开始的HTML和CSS之旅
【9月更文挑战第32天】在这个数字化的时代,拥有一个个人博客不仅是展示自我的平台,也是技术交流的桥梁。本文将引导初学者理解并实现一个简单的个人博客网站的搭建,涵盖HTML的基础结构、CSS样式的美化技巧以及如何将两者结合来制作一个完整的网页。通过这篇文章,你将学会如何从零开始构建自己的网络空间,并在互联网世界留下你的足迹。
一个好看的小时钟html+js+css源码
一个好看的小时钟html+js+css源码
428 24