# Animated Border Card

> A dark card with a gradient border that keeps rotating around its edge.

- Category: [CSS Cards](https://copy-css.com/category/cards)
- Tags: border, animated, conic, rotate, gradient, dark
- Live preview: https://copy-css.com/snippets/animated-border-card
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<div class="border-spin">
  <h3>Realtime sync</h3>
  <p>Every change shows up everywhere, instantly.</p>
</div>
```

## CSS

```css
.border-spin {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 220px;
  padding: 22px;
  border-radius: 16px;
  color: #cbd5e1;
  font: 14px/1.5 system-ui, sans-serif;
}

/* A spinning gradient, larger than the card */
.border-spin::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: -2;
  width: 200%;
  aspect-ratio: 1;
  background: conic-gradient(#22d3ee, #a855f7, #f43f5e, #22d3ee);
  translate: -50% -50%;
  animation: border-spin 4s linear infinite;
}

/* The inner panel covers all but a 2px edge */
.border-spin::after {
  content: "";
  position: absolute;
  inset: 2px;
  z-index: -1;
  border-radius: 14px;
  background: #0f172a;
}

.border-spin h3 {
  margin: 0 0 6px;
  color: #f8fafc;
  font-size: 17px;
}

.border-spin p {
  margin: 0;
}

@keyframes border-spin {
  to { rotate: 1turn; }
}

@media (prefers-reduced-motion: reduce) {
  .border-spin::before { animation: none; }
}
```

## Notes

- This CSS Animated Border Card is 52 lines of pure CSS (0.9 KB) with no JavaScript and no dependencies. It uses keyframe animations, conic gradients, aspect-ratio and reduced-motion support.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
