I have class that applies a dotted style border property to a text block at runtime. I am trying to find a solution, using CSS, that makes the border move like a gif image.
Here's a pretty flexible SCSS option:
$antlength: 50px;
$antwidth: 10px;
$antcolor: black;
@keyframes marching-ants {
0% {background-position: 0 0, $antlength 100%, 0 $antlength, 100% 0;}
100% {background-position: $antlength 0, 0 100%, 0 0, 100% $antlength;}
}
.ants {
background-image: linear-gradient(90deg, $antcolor 50%, transparent 50%),
linear-gradient(90deg, $antcolor 50%, transparent 50%),
linear-gradient(0, $antcolor 50%, transparent 50%),
linear-gradient(0, $antcolor 50%, transparent 50%);
background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
background-size: $antlength $antwidth, $antlength $antwidth, $antwidth $antlength, $antwidth $antlength;
animation: marching-ants 400ms infinite linear;
}