place-content
W3C CSS Snapshot 2026
Set align-content and justify-content together for the tracks inside the container.
On this page
Syntax and values
| Value or syntax | What it does |
|---|---|
center | Centers the entire grid on both axes. |
end space-between | Sets block-axis alignment to end and distributes inline-axis free space between tracks. |
Try the example
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>place-content example</title>
<style>
.layout { display: grid; 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 { width: min(100%, 320px); height: 155px; grid-template-columns: 56px 56px; grid-template-rows: 45px 45px; gap: 6px; }
.layout { place-content: center; }
</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 The grid of tracks sits in the middle of its outer border.