Ask any question about CSS here... and get an instant response.
Post this Question & Answer:
How can I create a responsive layout using CSS grid for a three-column design?
Asked on Mar 30, 2026
Answer
Creating a responsive three-column layout with CSS Grid is straightforward and allows for flexible designs that adapt to different screen sizes. Here's a basic example to get you started.
<!-- BEGIN COPY / PASTE -->
<div class="grid-container">
<div class="grid-item">Column 1</div>
<div class="grid-item">Column 2</div>
<div class="grid-item">Column 3</div>
</div>
<style>
.grid-container {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 10px;
}
.grid-item {
background-color: #f0f0f0;
padding: 20px;
text-align: center;
}
@media (max-width: 768px) {
.grid-container {
grid-template-columns: 1fr;
}
}
</style>
<!-- END COPY / PASTE -->Additional Comment:
- The "grid-template-columns: repeat(3, 1fr);" rule creates three equal columns.
- The "gap" property adds space between columns.
- The media query changes the layout to a single column on screens smaller than 768px.
- Adjust the breakpoint in the media query to suit your design needs.
Recommended Links:
