{
  "id": "expanding-cards",
  "name": "Expanding Cards",
  "category": "cards",
  "tags": [
    "expand",
    "accordion",
    "gallery",
    "hover",
    "flex",
    "panels"
  ],
  "description": "A row of image panels where the one you hover or focus grows to fill the space.",
  "url": "https://copy-css.com/snippets/expanding-cards",
  "markdown": "https://copy-css.com/snippets/expanding-cards.md",
  "html": "<div class=\"expand-cards\">\n  <a href=\"#\"><span>Mountains</span></a>\n  <a href=\"#\"><span>Forest</span></a>\n  <a href=\"#\"><span>Desert</span></a>\n  <a href=\"#\"><span>Ocean</span></a>\n</div>",
  "css": ".expand-cards {\n  display: flex;\n  gap: 8px;\n  width: 100%;\n  height: 300px;\n}\n\n/* Set each panel's background-image inline */\n.expand-cards > * {\n  flex: 1;\n  display: flex;\n  align-items: flex-end;\n  min-width: 0;\n  padding: 12px;\n  overflow: hidden;\n  border-radius: 14px;\n  background: #d4d4d8 center / cover;\n  color: #fff;\n  font: 700 14px system-ui, sans-serif;\n  text-decoration: none;\n  white-space: nowrap;\n  transition: flex-grow 0.45s ease;\n}\n\n.expand-cards span {\n  opacity: 0;\n  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);\n  transition: opacity 0.3s ease;\n}\n\n/* The hovered or focused panel grows. The first one is open by default. */\n.expand-cards > :hover,\n.expand-cards > :focus-visible,\n.expand-cards:not(:hover, :focus-within) > :first-child {\n  flex-grow: 4;\n}\n\n.expand-cards > :hover span,\n.expand-cards > :focus-visible span,\n.expand-cards:not(:hover, :focus-within) > :first-child span {\n  opacity: 1;\n}\n\n.expand-cards > :focus-visible {\n  outline: 2px solid #4338ca;\n  outline-offset: 2px;\n}",
  "features": [
    "transitions",
    "text shadows",
    "Flexbox",
    "keyboard focus styles"
  ],
  "customProperties": []
}
