Centering Cheat Sheet
Horizontal: margin auto for blocks, text-align for text. Vertical and both: flexbox with align-items and justify-content, or grid with place-items. Choose by context.
Example
<style>
.c { display: grid; place-items: center; height: 90px; background: #1e293b }
</style>
<div class="c">Centred both ways</div>Exercise
Centre in grid.
place-items: ;
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.