Grid Shorthand Property

Last updated: 2026-09-13

grid Grid Shorthand Property

The grid property is the CSS Grid shorthand. In one declaration it sets the explicit tracks, the auto tracks and the auto-flow direction of a grid container. It is the sum of the grid-template and grid-auto series and the most complete grid shorthand when you want to describe the whole grid structure.

Category
Initial Valuenone
InheritedNo
Applies Toall
Animation Typediscrete
CSS VersionCSS3
StatusStandard

📝 Syntax

grid: <grid-template> | <grid-template-rows> / [ <grid-auto-flow>? <grid-auto-columns>? ]?;

⚙️ Values

ValueTypeDescription
<grid-template>TypeExplicit grid shorthand
<grid-template-rows> / [ <grid-auto-flow>? <grid-auto-columns>? ]ValueRows/columns shorthand

▶ Example

Edit the code below and see the live result in the playground:

🌐 Browser Support

Browser ChromeChrome EdgeEdge FirefoxFirefox SafariSafari OperaOpera
grid v57 v16 v52 v10.1 v44
Supported in all major browsers
Tip: In the grid shorthand, the tracks before the slash / are the rows and the tracks after it are the columns, matching the grid-template writing order.
Warning: The grid shorthand resets every grid property that is not explicitly declared, such as grid-auto-flow. Keep this reset scope in mind when using it.

❓ FAQ

QWhat is the difference between grid and grid-template?
Agrid is the more sweeping shorthand: it resets the explicit tracks, the implicit tracks and the auto-placement direction in one go, which is useful for a clean grid initialization. grid-template only sets the explicit tracks (rows, columns, areas) and leaves the grid-auto-* properties untouched, so it has fewer side effects and is better when you only need to adjust the explicit structure.
QWhen should I use the grid shorthand?
AUse the grid shorthand when you need to define the whole grid structure at once, or when you want to reset all grid-related properties. If you only want to change one part, such as the column width, use a single property like grid-template-columns instead, so the shorthand cannot accidentally reset other grid settings. Pick one style for your team and stick to it, because mixing styles leads to hidden resets.
QHow does grid: 200px 1fr / 1fr 2fr map to rows and columns?
AIn the grid shorthand, the left side of the slash is grid-template-rows (rows) and the right side is grid-template-columns (columns). So grid: 200px 1fr / 1fr 2fr defines two rows (200px and 1fr) and two columns (1fr and 2fr). Remember “rows first, columns second” - it is the opposite of the columns-only intuition - and verify the result in a browser.

📚 Related Tutorials

Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏