Home › CSS Tutorial › CSS align
CSS align
Center and align in several ways.
Horizontal: margin:auto or text-align:center. Vertical and both: flexbox align-items and justify-content, or place-items:center in grid.
Example code
<style>.c{display:grid;place-items:center;height:140px;background:#eee}</style>
<div class='c'>Centered both ways</div>