Skip to content
Justice Tech School

Grid Alignment

justify-items and align-items align inside cells. justify-content and align-content align the whole grid in its container. place-items sets both.

Example
<style>
.g { display: grid; grid-template-columns: repeat(2, 60px); height: 100px; justify-content: center; align-content: center; gap: 6px } .g div { background: #0f766e; padding: 6px }
</style>
<div class="g"><div>A</div><div>B</div></div>

Exercise

Align items inside cells.

-items: center;

Quiz Test

What does align-content align?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.