# Expanding Details Card

> A card that smoothly grows to reveal extra text and a link on hover or focus, animating height with grid rows.

- Category: [CSS Cards](https://copy-css.com/category/cards)
- Tags: expand, hover, grid-template-rows, reveal, animate height, focus-within
- Live preview: https://copy-css.com/snippets/expanding-details-card
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<article class="more-card">
  <h3>Edge functions</h3>
  <p>Run code close to your users.</p>
  <div class="more-card-extra">
    <div>
      <p>Deploy in seconds to hundreds of locations, with no servers to manage.</p>
      <a href="#">Read the docs</a>
    </div>
  </div>
</article>
```

## CSS

```css
.more-card {
  width: 230px;
  padding: 18px 20px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 4px 16px -6px rgba(76, 29, 149, 0.25);
  color: #2e1065;
  font-family: system-ui, sans-serif;
}

.more-card h3 {
  margin: 0;
  font-size: 17px;
}

.more-card p {
  margin: 4px 0 0;
  color: #6d5c91;
  font-size: 14px;
  line-height: 1.5;
}

.more-card-extra {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.35s ease;
}

.more-card-extra > div {
  overflow: hidden;
}

.more-card:hover .more-card-extra,
.more-card:focus-within .more-card-extra {
  grid-template-rows: 1fr;
}

.more-card-extra p {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #ede9fe;
}

.more-card a {
  display: inline-block;
  margin: 8px 0 2px;
  color: #7c3aed;
  font-size: 14px;
  font-weight: 700;
}

.more-card a:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .more-card-extra {
    transition: none;
  }
}
```

## Notes

- This CSS Expanding Details Card is 61 lines of pure CSS (1.0 KB) with no JavaScript and no dependencies. It uses transitions, box shadows, CSS Grid and keyboard focus styles.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
