CSS Property Reference: flex Shorthand, gap and Compatibility

Open Tool CSS Properties Cheat Sheet

Why the categories matter

Properties are grouped into layout, text, background, border and animation, mirroring how a page gets built: arrange the boxes, then set type, then decorate, then consider motion. Shorthands sit beside their longhands — flex next to flex-grow, flex-shrink and flex-basis — so the expanded meaning is one glance away.

Steps

  1. Search a property name such as flex, color or border, with prefix matching.
  2. Filter with the category buttons: all, layout, text, background, border, animation.
  3. Load example shows a standard set; each entry opens values and sample code.

flex with one value sets three

flex: 1 expands to grow 1, shrink 1, basis 0%, so items may grow and shrink with a zero starting width, which is why several flex:1 children split leftover space evenly and content never affects the base. flex: auto takes content width as the basis while still allowing both directions. flex: none equals 0 0 auto, fully rigid, suited to fixed icon containers. Writing flex:1 while expecting content to define width is the usual reason things look squashed.

What gap fixed

In flex and grid, gap spaces children directly, removing the old tricks of margin-right on each child plus negative container margins, or :not(:last-child) selectors — both of which break awkwardly on wrapping. gap keeps correct spacing across lines, its most practical benefit. Modern browsers support it, though embedded legacy engines deserve a check.

Three questions before you ask

First, does the property apply to the container or the child? Getting that backwards means no effect. Second, which rule wins specificity — inline styles, id selectors and !important all change the answer. Third, is a prefix or fallback needed, since tables show the standard form while projects follow their target browsers. Settle those and the table actually helps; skip them and you conclude the property is broken.

⏫︎