{
  "id": "image-scrim-gradient",
  "name": "Image Scrim Gradient",
  "category": "gradients",
  "tags": [
    "overlay",
    "text on image",
    "readable",
    "caption",
    "eased"
  ],
  "description": "An eased dark gradient over a photo so white caption text stays readable without a hard edge.",
  "url": "https://copy-css.com/snippets/image-scrim-gradient",
  "markdown": "https://copy-css.com/snippets/image-scrim-gradient.md",
  "html": "<figure class=\"scrim-card\">\n  <img src=\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 300'%3E%3Cdefs%3E%3ClinearGradient id='g' x2='0' y2='1'%3E%3Cstop stop-color='%23fb923c'/%3E%3Cstop offset='1' stop-color='%23fde68a'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='400' height='300' fill='url(%23g)'/%3E%3Ccircle cx='290' cy='110' r='36' fill='%23fff7ed'/%3E%3Cpath d='M0 200 110 110l80 70 70-50 140 100v170H0z' fill='%237c3aed'/%3E%3Cpath d='M0 240 90 180l120 80 70-40 120 70v110H0z' fill='%233b0764'/%3E%3C/svg%3E\" alt=\"Purple mountains at sunset\">\n  <figcaption>\n    <strong>Sunset ridge trail</strong>\n    <span>12 km · Moderate</span>\n  </figcaption>\n</figure>",
  "css": ".scrim-card {\n  position: relative;\n  width: min(100%, 280px);\n  margin: 0;\n  overflow: hidden;\n  border-radius: 16px;\n  font: 14px/1.3 system-ui, sans-serif;\n}\n\n.scrim-card img {\n  display: block;\n  width: 100%;\n  aspect-ratio: 3 / 2;\n  object-fit: cover;\n}\n\n/* Many stops ease the fade, so there is no visible line where it starts */\n.scrim-card::after {\n  content: \"\";\n  position: absolute;\n  inset: 0;\n  background: linear-gradient(\n    to top,\n    #000000b3 0%,\n    #000000a1 14%,\n    #00000080 28%,\n    #00000059 42%,\n    #00000033 56%,\n    #00000014 70%,\n    #0000 85%\n  );\n}\n\n.scrim-card figcaption {\n  position: absolute;\n  inset: auto 0 0;\n  z-index: 1;\n  display: grid;\n  gap: 2px;\n  padding: 16px;\n  color: #fff;\n}\n\n.scrim-card strong {\n  font-size: 18px;\n}\n\n.scrim-card span {\n  color: #e5e7eb;\n}",
  "features": [
    "linear gradients",
    "CSS Grid",
    "aspect-ratio"
  ],
  "customProperties": []
}
