---
title: "Grid: how grid-template-areas offer a visual solution for your code"
description: "CSS Grid's grid-template-areas lets you place elements by naming them with the grid-area property and then drawing the layout as rows of quoted strings, where repeating a name across cells makes an element span rows or columns."
url: "https://swe.quest/articles/grid-how-grid-template-areas-offer-a-visual-solution-for-your-code-81a307f52b1b6dda"
canonical: "https://webkit.org/blog/17620/grid-how-grid-template-areas-offer-a-visual-solution-for-your-code/"
source: "WebKit"
published: "2025-11-21"
difficulty: "medium"
kind: "How-to"
reading_minutes: 3
tags: ["css","frontend"]
---

# Grid: how grid-template-areas offer a visual solution for your code

A post on [WebKit](https://swe.quest/sources/webkit.md), published 2025-11-21, 3 min read, How-to. Original: [https://webkit.org/blog/17620/grid-how-grid-template-areas-offer-a-visual-solution-for-your-code/](https://webkit.org/blog/17620/grid-how-grid-template-areas-offer-a-visual-solution-for-your-code/)

## Summary

CSS Grid's grid-template-areas lets you place elements by naming them with the grid-area property and then drawing the layout as rows of quoted strings, where repeating a name across cells makes an element span rows or columns. A product-card page shows the technique: an add-ons card spans two rows and a testimonial spans two columns in a three-column grid. The upfront cost is naming each element. In return, all placement decisions live in one readable property, and you change the layout by moving names between cells.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [CSS](https://swe.quest/tags/css.md) (Web & mobile)
- [Frontend](https://swe.quest/tags/frontend.md) (Web & mobile)

## Prerequisites

- CSS basics ([easy posts on CSS](https://swe.quest/tags/css.md?difficulty=easy))
- CSS Grid basics ([easy posts on CSS](https://swe.quest/tags/css.md?difficulty=easy))

## Keywords

CSS Grid, grid-template-areas, grid-area, WebKit

## Related posts

- [CSS Grid: A helpful mental model and the power of grid lines](https://swe.quest/articles/css-grid-a-helpful-mental-model-and-the-power-of-grid-lines-4d5050e2d975310a.md): WebKit · 2025-10-10 · Medium · 9 min read · CSS, Frontend
  CSS Grid becomes easier to reason about when a layout starts from the container, treated like a spreadsheet whose columns and rows are defined before content is placed.
- [Subgrid: how to line up elements to your heart’s content](https://swe.quest/articles/subgrid-how-to-line-up-elements-to-your-heart-s-content-a1a2b0f9110769af.md): WebKit · 2025-09-12 · Medium · 4 min read · CSS, Frontend
  CSS subgrid lets nested grid items adopt the row or column tracks defined on a parent grid, so content inside sibling cards stays aligned even when one card has longer text.
- [Help us invent CSS Grid Level 3, aka “Masonry” layout](https://swe.quest/articles/help-us-invent-css-grid-level-3-aka-masonry-layout-ed399042099ed6d0.md): WebKit · 2024-04-19 · Medium · 19 min read · CSS, Browsers, Frontend
  CSS Grid Level 3, often called masonry or waterfall layout, adds \`grid-template-rows: masonry\` so content packs into columns without rows, with no JavaScript and no cropping.
- [Introducing CSS Grid Lanes](https://swe.quest/articles/introducing-css-grid-lanes-2d3c264610a9740d.md): WebKit · 2025-12-19 · Medium · 8 min read · CSS, Browsers, Frontend, Accessibility
  CSS Grid Lanes (\`display: grid-lanes\`) brings native masonry layouts to the web, available in Safari Technology Preview 234.
- [Help us choose the final syntax for Masonry in CSS](https://swe.quest/articles/help-us-choose-the-final-syntax-for-masonry-in-css-49421042d3732dc4.md): WebKit · 2024-10-21 · Medium · 31 min read · CSS, Browsers, Language design
  WebKit argues that masonry-style packed layout should be specified as part of CSS Grid ("Just Use Grid", e.g. grid-template-rows: collapse) rather than as a separate display: masonry mode with its own masonry-\* properties, as the Chrome team and Rachel Andrew propose.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
