.grid-container {\n display: grid;\n grid-template-columns: repeat(4, 1fr);\n}\n\n.grid-item.full-width {\n grid-column-start: 1;\n grid-column-end: 5;\n}<\/code><\/pre>\n\n\n\nIt works like a charm, but what if the number of columns changes to six? In that case, we need to update the index value for the placement property.<\/p>\n\n\n\n
The flexible solution is to use the negative index!<\/p>\n\n\n\n
.grid-item.full-width {\n grid-column-start: 1;\n grid-column-end: -1;\n}<\/code><\/pre>\n\n\n\nNow, no matter how many columns we have, the grid item with the full-width<\/code> class always stretches across the grid.<\/p>\n\n\nGrid line indexes depend on the writing mode<\/h3>\n\n\n
The whole module of grid layout is based on the writing mode of the document; hence, grid lines depend on the direction and writing mode as well. For example, in a right-to-left language like Persian and Arabic, the first grid line with 1<\/code> index is the right-most line in a grid.<\/p>\n\n\n\n