← TechnologyThe essentials of

gap: spacing between elements, no external edging

Publisher: ResumeMaker • 1 source

Published: 22 Oct 2026 13:13 · Updated: 22 Oct 2026 13:13

AI source check: 21 Oct 2026 10:36. This is not editorial approval.

In a few sentences

In brief

gap sets the gaps in grid and flex layouts; the distance to the edge of the container remains a separate task.

Useful to know

gap defines the spacing between rows and columns in supported layouts, including grid and flex. With one value, both gaps are set; with two values, the first is for the rows and the second is for the columns. [1]

In grid with three columns and gap: 16px; there are two spaces between the columns. This does not automatically add 16 pixels between the end cards and the edge of the container. For such an internal edge, you can set padding on the container.

In flex, the direction is relevant to the way the gaps are placed between the elements and the rows. Try the specific configuration, especially when there is a flex-wrap. If the distances seem larger than gap, also check margin and allocation by justify-content: they can add space regardless of the specified gap. [1]

Sources

For further detail and to check the information:

  1. [1] MDN — gap ↗