row-gap

W3C CSS Snapshot 2026

Set the row gap. In a row flex container this is the distance between flex lines. In a column flex container it separates items within a line.

On this page

Syntax and values

Value or syntaxWhat it does
normalThe initial value resolves to zero in this layout.
16pxUses a nonnegative length.
5%Uses a percentage of the container’s content box on the gap axis.

Try the example

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>row-gap example</title>
  <style>
.layout { display: flex; width: min(100%, 320px); border: 2px solid teal; box-sizing: border-box; }
.layout > div { padding: 8px 12px; background: #def5f5; color: #123; border: 1px solid #81b9b5; box-sizing: border-box; }
.layout { flex-wrap: wrap; }
.layout > div { flex: 0 0 42%; }
.layout { row-gap: 16px; }
  </style>
</head>
<body>
<div class="layout">
  <div class="first">A</div>
  <div class="second">B</div>
  <div>C</div>
</div>
</body>
</html>

What to expect Change 16px to 0 and compare the spacing between flex lines.

Official references