Why CSS Grid?
CSS Grid is the most powerful layout system in CSS. It's a two-dimensional system that can handle both columns and rows โ unlike Flexbox which is primarily one-dimensional.
Basic Grid Setup
.container {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 1rem;
}
Grid Areas
One of the most powerful features of CSS Grid is the ability to name and position areas:
.layout {
display: grid;
grid-template-areas:
"header header header"
"sidebar content content"
"footer footer footer";
grid-template-columns: 250px 1fr 1fr;
}
Responsive Grids
CSS Grid makes responsive design simple with auto-fit and minmax:
.auto-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 1.5rem;
}
Using Grid in BuildHub
BuildHub's visual builder supports custom CSS grid layouts. You can define column templates, set gaps, and create complex layouts โ all without leaving the editor.