console
<div class="box">
<div></div>
<div></div>
<div></div>
<div></div>
跑马灯边框
</div>
.box{
width: 200px;
height: 80px;
background-color: transparent;
position: absolute;
top: 50%;
margin-top: -40px;
left: 50%;
margin-left: -100px;
text-align: center;
line-height: 80px;
overflow: hidden;
}
.box :nth-child(1){
background: linear-gradient(to right, transparent , #0FF);
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 5px;
animation: run1 1s linear infinite;
}
.box :nth-child(2){
background: linear-gradient(to bottom, transparent , #0FF);
position: absolute;
top: 0;
left: 195px;
height: 100%;
width: 5px;
animation: run2 1s linear infinite;
animation-delay: .3s;
}
.box :nth-child(3){
background: linear-gradient(to left, transparent , #0FF);
position: absolute;
top: 75px;
left: 0;
width: 100%;
height: 5px;
animation: run3 1s linear infinite;
animation-delay: .6s;
}
.box :nth-child(4){
background: linear-gradient(to top, transparent , #0FF);
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 5px;
animation: run4 1s linear infinite;
animation-delay: .9s;
}
@keyframes run1{
0%{
transform: translateX(-400px);
}
100%{
transform: translateX(400px);
}
}
@keyframes run2{
0%{
transform: translateY(-160px);
}
100%{
transform: translateY(160px);
}
}
@keyframes run3{
0%{
transform: translateX(400px);
}
100%{
transform: translateX(-400px);
}
}
@keyframes run4{
0%{
transform: translateY(160px);
}
100%{
transform: translateY(-160px);
}
}