concept

Grid item — CSS reference

An in-flow child of a grid container becomes a grid item; contiguous non-whitespace text can generate anonymous grid items. Descendants inside an ordinary child are not themselves items of the outer grid. Items may span multiple cells or overlap.

Formal Syntax & Structure

css syntaxcss
A grid container’s in-flow child box

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>Grid item</title><style>body{margin:0}#g{display:grid;width:300px;grid-template-columns:100px 100px 100px;grid-template-rows:40px 40px;}#g>*{background:#146e73;color:white;box-sizing:border-box}#b{background:#345d8e}#c{background:#79518e}</style><body><div id="g"><div id="a" style="grid-column:span 2"><span>Nested text</span></div><div id="b">B</div></div></body></html>
CSS Reference