Thick diagonal stripes in the accent and white roll around a frame like a barber pole. A repeating gradient in a tile exactly one stripe period wide slides one tile per loop, so it never stutters.
Also known as: striped border css, barber pole border animation, candy cane border.
<div class="bdr-candy-stripe-border"><strong class="bdr-candy-stripe-border-title">Work in progress</strong><span class="bdr-candy-stripe-border-note">Back soon</span></div>
.bdr-candy-stripe-border {
--c: var(--bdr-color, #3b82f6);
font-size: var(--bdr-size, 16px);
position: relative;
display: grid;
place-items: center;
width: 15em;
height: 8.5em;
border-radius: 1em;
font-family: system-ui, sans-serif;
font-weight: 600;
box-sizing: border-box;
align-content: center;
gap: 0.2em;
border: 0.5em solid transparent;
background:
linear-gradient(#fff, #fff) padding-box,
repeating-linear-gradient(45deg, var(--c) 0 0.5em, color-mix(in srgb, var(--c) 12%, #fff) 0 1em) 0 0 / 1.4142em 1.4142em border-box;
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 45%, transparent);
color: #111827;
animation: bdr-candy-stripe-border-roll 1s linear infinite;
}
.bdr-candy-stripe-border-title { font-weight: 700; }
.bdr-candy-stripe-border-note {
color: color-mix(in srgb, var(--c) 60%, #334155);
font-size: 0.8em;
font-weight: 500;
}
@keyframes bdr-candy-stripe-border-roll {
to { background-position: 0 0, 1.4142em 0; }
}
@media (prefers-reduced-motion: reduce) {
.bdr-candy-stripe-border, .bdr-candy-stripe-border *, .bdr-candy-stripe-border::before, .bdr-candy-stripe-border::after, .bdr-candy-stripe-border *::before, .bdr-candy-stripe-border *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}--bdr-color on the element or a parent.
Currently previewing #3b82f6.--bdr-size. Every other dimension is in
em, so the whole thing scales together. Currently previewing 16px.transition or animation
shorthand. Staggered delays are relative, so they keep their rhythm.