Home › CSS Tutorial › Grid container and items
Grid container and items
Template areas and spans.
Use grid-template-columns, grid-template-areas, repeat(), minmax() and auto-fit for responsive grids.
Example code
<style>
.g{display:grid;grid-template-columns:repeat(auto-fit,minmax(90px,1fr));gap:8px}
.g div{background:#8e44ad;color:#fff;padding:14px}
</style>
<div class='g'><div>1</div><div>2</div><div>3</div><div>4</div><div>5</div></div>