Line-based placement shorthand – grid-area
We can achieve the same result as in example 2 and 3 declaring all four values with the grid-area
property. Again values are separated with a /
. The order of the values is row-start/column-start/row-end/column-end
.
Credit to gridbyexample.com for inspiring this example.
[fl_row] { display:grid; grid-gap: 10px; grid-template-columns: 1fr 1fr 1fr; } [fl_row] .a { grid-area: 1 / 2 / 2 / 3; } [fl_row] .b { grid-area: 2 / 2 / 3 / 3; } [fl_row] .c { grid-area: 2 / 3 / 3 / 4; } [fl_row] .d { grid-area: 1 / 1 / 2 / 2; } [fl_row] .e { grid-area: 2 / 1 / 3 / 2; } [fl_row] .f { grid-area: 1 / 3 / 2 / 4; }