# Radio Cards

> Large, clickable option cards built on real radio buttons, highlighted with :has().

- Category: [CSS Form Elements](https://copy-css.com/category/forms)
- Tags: radio, cards, choice, has, selection
- Live preview: https://copy-css.com/snippets/radio-cards
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<div class="radio-cards">
  <label><input type="radio" name="plan" checked><strong>Monthly</strong><span>$9 / month</span></label>
  <label><input type="radio" name="plan"><strong>Yearly</strong><span>$90 / year</span></label>
</div>
```

## CSS

```css
.radio-cards {
  display: flex;
  gap: 10px;
  font-family: system-ui, sans-serif;
}

.radio-cards label {
  position: relative;
  display: grid;
  flex: 1 1 0;
  gap: 2px;
  min-width: 0;
  padding: 14px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

/* Keep the radio accessible but invisible */
.radio-cards input {
  position: absolute;
  opacity: 0;
}

.radio-cards strong {
  color: #0f172a;
  font-size: 15px;
}

.radio-cards span {
  color: #64748b;
  font-size: 13px;
}

.radio-cards label:has(:checked) {
  border-color: #0ea5e9;
  background: #f0f9ff;
}

.radio-cards label:has(:focus-visible) {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
}
```

## Notes

- This CSS Radio Cards is 45 lines of pure CSS (0.8 KB) with no JavaScript and no dependencies. It uses transitions, CSS Grid, Flexbox and the :has() selector.
- the :has() selector: Chrome 105+, Safari 15.4+, Firefox 121+.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
