What does the grid-template property do?
grid-template is a shorthand that combines three properties into one:
grid-template-rowsgrid-template-columnsgrid-template-areas
That is, with it you can set rows, columns, and named grid areas at the same time.
Example:
css
.container {
display: grid;
grid-template:
"header header" 100px
"sidebar main" 1fr
"footer footer" 80px
/ 200px 1fr;
}Equivalent to three separate declarations:
css
grid-template-areas:
"header header"
"sidebar main"
"footer footer";
grid-template-rows: 100px 1fr 80px;
grid-template-columns: 200px 1fr;Summary: grid-template is a convenient combined notation that lets you set the structure of rows, columns, and areas in Grid with a single property.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.