效果图:
代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body{
background: rgb(0,0,0,0.8);
}
#div1{
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
margin: auto;
width: 300px;
height: 400px;
overflow: hidden;
/*使伪类元素flex布局*/
display: flex;
/*左右居中*/
justify-content: center;
/*所有的子元素居中*/
align-items: center;
background: #000000;
border-radius: 12px;
}
#div1::after{
content: "";
width: 500px;
height: 500px;
position: absolute;
background-image: conic-gradient(transparent,transparent,transparent,#7557D1);
animation:animate 4s infinite linear;
}
#div1::before {
content: "";
width: 500px;
height: 500px;
position: absolute;
transform: rotate(180deg);
background-image: conic-gradient(transparent, transparent, transparent, #EA4878);
animation:animate 4s infinite linear;
animation-delay: -2s;
}
#div1 span{
position: relative;
margin: 0 auto;
background: #333333;
z-index: 12;
width: 290px;
height: 390px;
border-radius: 12px;
}
#div1 h2{
color: #fff;
line-height: 400px;
text-align: center;
font-size: 5em;
}
@keyframes animate {
0%{
transform: rotate(0deg);
}
100%{
transform: rotate(360deg);
}
}
</style>
<body>
<div id="div1">
<span>
<h2>1</h2>
</span>
</div>
</body>
</html>
本文来自博客园,作者:最帅爸爸,转载请注明原文链接:https://www.cnblogs.com/zsbb
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了