Animated Gradient Border Card
Continuously rotating conic-gradient border using a pseudo-element with rotate keyframes. No JavaScript needed.
Animated Gradient Border Card the 4th of 20 designs in the 20 CSS Cards with Animations collection. The design is implemented in pure CSS — no JavaScript required. Copy the HTML and CSS panels below into your project. Because the demo is pure CSS, it works in any framework or templating engine you happen to use. The design honours prefers-reduced-motion and uses real semantic markup, so it ships accessibility-ready out of the box.
Live preview
The code
<div class="stage-4">
<div class="card-grad-border">
<h4>Spinning Gradient</h4>
<p>Conic-gradient border spins continuously using CSS animation.</p>
<span class="grad-tag">Live animation</span>
</div>
</div> .card-grad-border {
width: 200px;
padding: 20px;
border-radius: 14px;
background: #111118;
position: relative;
}
.card-grad-border::before {
content: "";
position: absolute;
inset: -2px;
border-radius: 16px;
background: conic-gradient(#7c6cff, #ff6c8a, #3de8f5, #1ed98a, #7c6cff);
z-index: -1;
animation: ccg-grad-spin 3s linear infinite;
}
.card-grad-border h4 {
font-size: 13px;
font-weight: 700;
color: #fff;
margin-bottom: 6px;
}
.card-grad-border p {
font-size: 11px;
color: var(--ccg-muted);
line-height: 1.5;
margin-bottom: 12px;
}
.grad-tag {
display: inline-block;
font-size: 10px;
padding: 2px 8px;
border-radius: 20px;
background: rgba(124, 108, 255, 0.2);
color: var(--ccg-accent);
}
/* parent stage backdrop (so the demo renders standalone) */
[class^="stage-"] {
width: 100%;
min-height: 200px;
display: flex;
align-items: center;
justify-content: center;
position: relative;
padding: 2.5rem 1.5rem;
box-sizing: border-box;
}
.stage-4 {
background: #090912;
overflow: hidden;
}
/* gallery vars + keyframes (so the demo renders standalone) */
:root {
--ccg-bg: #0a0a0f;
--ccg-surface: #111118;
--ccg-surface2: #17171f;
--ccg-surface3: #1e1e28;
--ccg-border: rgba(255, 255, 255, 0.15);
--ccg-border2: rgba(255, 255, 255, 0.13);
--ccg-accent: #7c6cff;
--ccg-pink: #ff6c8a;
--ccg-green: #1ed98a;
--ccg-amber: #f5a84a;
--ccg-cyan: #3de8f5;
--ccg-text: #f0eeff;
--ccg-muted: #6b6987;
--ccg-label: #9896b8;
--ccg-mono: "DM Mono", "Fira Code", monospace;
--ccg-sans: "Syne", sans-serif;
}
@keyframes ccg-grad-spin {
to {
transform: rotate(360deg);
}
}
@media (prefers-reduced-motion: reduce) {
.card-grad-border,
.card-grad-border * {
animation: none !important;
}
}