<style>@keyframes flowing-border {
0% {
box-shadow: inset 0 0 0 2px #ff0000;
}
25% {
box-shadow: inset 0 0 0 2px #00ff00;
}
50% {
box-shadow: inset 0 0 0 2px #0000ff;
}
75% {
box-shadow: inset 0 0 0 2px #ffff00;
}
100% {
box-shadow: inset 0 0 0 2px #ff00ff;
}
}
.flowing-box {
/* 其他样式 */
animation: flowing-border 5s linear infinite;
}
</style>效果:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
.flowing-box {
width: 200px;
height: 150px;
background-color: #fff;
position: relative;
}
@keyframes flowing-border {
0% {
box-shadow: inset 0 0 0 2px #ff0000;
}
25% {
box-shadow: inset 0 0 0 2px #00ff00;
}
50% {
box-shadow: inset 0 0 0 2px #0000ff;
}
75% {
box-shadow: inset 0 0 0 2px #ffff00;
}
100% {
box-shadow: inset 0 0 0 2px #ff00ff;
}
}
.flowing-box {
/* 其他样式 */
animation: flowing-border 5s linear infinite;
}
</style>
</head>
<body>
<div class="flowing-box">这是一个box</div>
</body>
</html>
CSS特效——背景色彩不停流动效果
css背景动态渐变效果
😊😊😊🤔🤔