{"id":374225,"date":"2022-10-17T07:12:00","date_gmt":"2022-10-17T14:12:00","guid":{"rendered":"https:\/\/css-tricks.com\/?page_id=374225"},"modified":"2022-10-18T09:03:56","modified_gmt":"2022-10-18T16:03:56","slug":"grid-column","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/properties\/g\/grid-column\/","title":{"rendered":"grid-column"},"content":{"rendered":"\n

The grid-column<\/code> CSS property is a shorthand that specifies the column grid lines where a grid item starts and ends in a grid layout in one declaration.<\/p>\n\n\n\n

.grid-container {\n  display: grid;\n  grid-template-columns: repeat(4, 1fr);\n}\n\n.grid-item:nth-child(2) {\n  grid-column: 3 \/ 5; \/* Starts on the third column line and ends on the fifth column line *\/\n}<\/code><\/pre>\n\n\n\n

Because of CSS Grid\u2019s default auto-placement behavior, the second child element of the grid in this example would normally be placed in the second column of the grid\u2019s first row. But since we declared grid-column<\/code> and set it to align the grid item\u2019s starting edge with the third grid line and its ending edge with the fifth grid line, the item to spans the third and fourth columns instead of a single column.<\/p>\n\n\n\n\n\n\n\n

\"\"
Setting the location and the size of the second grid item using the grid-column<\/code> CSS Grid property.<\/figcaption><\/figure>\n\n\n

Constituent properties<\/h3>\n\n\n

As mentioned, the grid-column<\/code> property is a shorthand that combines two properties:<\/p>\n\n\n\n \t\t\n

\n
\n\n