{
  "id": "max-columns-grid",
  "name": "Max Columns Grid",
  "category": "layouts",
  "tags": [
    "responsive grid",
    "auto-fill",
    "column limit",
    "minmax",
    "cards"
  ],
  "description": "A responsive auto-fill grid that wraps on small screens but never grows past a set number of columns.",
  "url": "https://copy-css.com/snippets/max-columns-grid",
  "markdown": "https://copy-css.com/snippets/max-columns-grid.md",
  "html": "<div class=\"grid-max\">\n  <div></div>\n  <div></div>\n  <div></div>\n  <div></div>\n  <div></div>\n  <div></div>\n  <div></div>\n</div>",
  "css": ".grid-max {\n  --cols: 3;   /* never more than this */\n  --min: 200px; /* never narrower than this */\n  --gap: 16px;\n  display: grid;\n  grid-template-columns: repeat(\n    auto-fill,\n    minmax(min(100%, max(var(--min), (100% - (var(--cols) - 1) * var(--gap)) / var(--cols))), 1fr)\n  );\n  gap: var(--gap);\n}",
  "features": [
    "CSS Grid",
    "custom properties"
  ],
  "customProperties": [
    {
      "name": "--cols",
      "value": "3"
    },
    {
      "name": "--min",
      "value": "200px"
    },
    {
      "name": "--gap",
      "value": "16px"
    }
  ]
}
