When working with grid-template-areas in CSS grid, I encountered a situation where I wanted a header to span the entire width. Instead of defining the template-grid-columns with repeat(12, 1fr), I was searching for a way to utilize repeat() so that I wouldn't have to manually list the column name 12 times. Take a look at the example below.
grid-template-areas:
"article-hero article-hero article-hero article-hero article-hero article-hero article-hero article-hero article-hero article-hero article-hero article-hero"
"header header header header header header header header header header header header"
"main main main main main main main main main aside aside aside"
"footer footer footer footer footer footer footer footer footer footer footer footer";
In the first row where 'article-hero' is repeated twelve times, I am wondering if there is a way to use repeat instead, such as repeat(12, article-hero)
, rather than manually repeating it 12 times?