本帖最后由 凡哥 于 2024-6-5 20:06 编辑
2024年6月5日 星期三
彩色流动边框的实现
<style>
#bbox {
margin: auto;
width: 400px;
height: 200px;
overflow: hidden;
display: grid;
place-items: center;
position: relative;
}
#bbox::before, #bbox::after {
position: absolute;
content: '';
z-index: -1;
}
#bbox::before {
width: 460px;
height: 460px;
background: linear-gradient(red, green, orange, blue);
border-radius: 50%;
animation: rot 4s linear infinite;
}
#bbox::after {
background: silver;
inset: 4px;
}
@keyframes rot { to { transform: rotate(360deg); } }
</style>
<div id="bbox"></div>
效果:
|