.box
.top
.bottom
.left
.right
View Compiled
.box {
position: relative;
width: 200px;
height: 200px;
margin: 0 auto;
border: 3px solid transparent;
}
.top,
.bottom,
.left,
.right {
position: absolute;
animation: 8s linear infinite;
animation: 8s linear infinite;
}
.top {
top: -3px;
left: -3px;
height: 3px;
animation-name: top;
animation-name: top;
}
@-webkit-keyframes top {
25% {
width: 0;
background: #ffdb00;
}
38% {
width: calc(103%);
background: #ffdb00;
}
50% {
background: #ffdb00;
}
62% {
background: #ffdb00;
}
75% {
width: calc(103%);
background: #ffdb00;
}
88% {
left: auto;
right: -3px;
width: 0;
background: #ffdb00;
}
}
.bottom {
bottom: -3px;
right: -3px;
height: 3px;
animation-name: bottom;
animation-name: bottom;
}
@-webkit-keyframes bottom {
0% {
width: 0;
}
12% {
width: calc(103%);
background: #ffdb00;
}
25% {
background: #ffdb00;
}
38% {
background: #ffdb00;
}
50% {
width: calc(103%);
background: #ffdb00;
}
62% {
left: -3px;
width: 0;
background: #ffdb00;
}
75% {
background: #ffdb00;
}
}
.left {
bottom: -3px;
left: -3px;
width: 3px;
animation-name: left;
animation-name: left;
}
@-webkit-keyframes left {
12% {
height: 0;
background: #ffdb00;
}
25% {
height: calc(103%);
background: #ffdb00;
}
38% {
background: #ffdb00;
}
50% {
background: #ffdb00;
}
62% {
height: calc(103%);
background: #ffdb00;
}
75% {
top: -3px;
height: 0;
background: #ffdb00;
}
88% {
background: #ffdb00;
}
}
.right {
top: -3px;
right: -3px;
width: 3px;
animation-name: right;
animation-name: right;
}
@-webkit-keyframes right {
38% {
height: 0;
background: #ffdb00;
}
50% {
height: calc(103%);
background: #ffdb00;
}
62% {
background: #ffdb00;
}
75% {
background: #ffdb00;
}
88% {
height: calc(103%);
background: #ffdb00;
}
100% {
top: auto;
bottom: -3px;
height: 0;
background: #ffdb00;
}
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.