Should it be a separate div? I can't figure out how to apply this to a div that already has some content.
.dashed-line {
height: 3px;
width: 700px;
background: linear-gradient(90deg, red 50%, transparent 50%), linear-gradient(90deg, red 50%, transparent 50%);
background-size: 0px 0px, 15px 4px, 4px 0px, 4px 0px;
background-position: 0px 0px, 200px 100px, 0px 100px, 200px 0px;
margin-left: 15px;
animation: border-dance 7s infinite linear;
}
@keyframes border-dance {
0% {
background-position: 300px 0px, 0px 116px, 0px 0px, 216px 150px;
}
100% {
background-position: 0px 0px, 300px 116px, 0px 150px, 216px 0px;
}
}
<div class="dashed-line"></div>