{
  "id": "centered-last-row",
  "name": "Centered Last Row Grid",
  "category": "layouts",
  "tags": [
    "flex-wrap",
    "orphans",
    "centered",
    "responsive grid",
    "logos",
    "team"
  ],
  "description": "A wrapping grid of equal cards where an uneven last row is centered instead of hugging the left.",
  "url": "https://copy-css.com/snippets/centered-last-row",
  "markdown": "https://copy-css.com/snippets/centered-last-row.md",
  "html": "<div class=\"grid-center\">\n  <div></div>\n  <div></div>\n  <div></div>\n  <div></div>\n  <div></div>\n  <div></div>\n  <div></div>\n</div>",
  "css": "/* Flexbox, not Grid: only flex can center a short last row */\n.grid-center {\n  --cols: 3;\n  --min: 180px;\n  --gap: 16px;\n  display: flex;\n  flex-wrap: wrap;\n  justify-content: center;\n  gap: var(--gap);\n}\n\n.grid-center > * {\n  flex: 0 1 calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols));\n  min-width: min(100%, var(--min));\n}",
  "features": [
    "Flexbox",
    "custom properties"
  ],
  "customProperties": [
    {
      "name": "--cols",
      "value": "3"
    },
    {
      "name": "--min",
      "value": "180px"
    },
    {
      "name": "--gap",
      "value": "16px"
    }
  ]
}
