{"id":318980,"date":"2020-08-13T15:49:50","date_gmt":"2020-08-13T22:49:50","guid":{"rendered":"https:\/\/css-tricks.com\/?page_id=318980"},"modified":"2022-09-22T11:33:17","modified_gmt":"2022-09-22T18:33:17","slug":"gap","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/properties\/g\/gap\/","title":{"rendered":"gap"},"content":{"rendered":"\n

The gap property in CSS is a shorthand for row-gap<\/code> and column-gap<\/code>, specifying the size of gutters, which is the space between rows and columns within grid<\/a>, flex<\/a>, and multi-column<\/a> layouts.<\/p>\n\n\n\n

\/* Grid layout *\/\n.container {\n  display: grid;\n  grid-template-columns: repeat(3, 1fr);\n  grid-template-rows: 1fr 2fr 1fr;\n  gap: 30px 20px;\n}\n\n\/* Flex layout *\/\n.container {\n\u00a0 display: flex;\n\u00a0 gap: 10%;\n}\n\n\/* Multi-column layout *\/\n.container {\n  column-count: 5;\n  gap: 20px;\n}<\/code><\/pre>\n\n\n\n\n\n\n\n
\"Diagram<\/figure>\n\n\n\n

Use the slider in the demo below to see the gap<\/code> property in action:<\/p>\n\n\n\n