Grid Template Areas in CSS


Define layout areas in CSS Grid with grid-template-areas for a more readable layout structure.

Source Code

.grid-container {
    display: grid;
    grid-template-areas:
        'header header header'
        'nav content sidebar'
        'footer footer footer';
    grid-gap: 10px;
}
.header { grid-area: header; }
.nav { grid-area: nav; }
.content { grid-area: content; }
.sidebar { grid-area: sidebar; }
.footer { grid-area: footer; }
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments