</> Code Corner

CSS · CSS Grid · Lesson 62

CSS Grid Intro

Two-dimensional layouts with rows and columns.

The CSS Grid Layout Module offers a grid-based layout system with rows and columns, making it easier to design pages without floats and positioning.

Example

<style>
.grid { display: grid; grid-template-columns: auto auto auto; gap: 10px; background: #2196F3; padding: 10px; }
.grid div { background: rgba(255,255,255,0.85); padding: 20px; font-size: 24px; text-align: center; }
</style>
<div class="grid">
  <div>1</div><div>2</div><div>3</div><div>4</div><div>5</div><div>6</div>
</div>
Tip: A grid has a parent grid container and one or more grid items. The vertical lines are columns, the horizontal lines are rows, and the spaces between are gaps.

Keep reading “CSS Grid Intro”

Sign up to read the full lesson, try every example in the live editor, and take the 5-question quiz.

Chat with us 👋