I'm trying to make a calendar using a grid layout. Each day of the week will have a header. My goal is to set the height of the header (ie: the first row in the grid) to 30px, and have the rest of the rows split the rest of the available space.
My calendar CSS looks like this:
.calendar{
display:grid;
grid-template-columns:repeat(1,1fr);
grid-template-rows:30px repeat(auto-fill,1fr);
}
Now, I thought that would do exactly what I want, but that 30px
has no effect, and each row is an equal height. Is it possible to mix a static value and repeat()
?
I realize I can just make 2 grids - one for the headers and one for the days - but I'm curious if there's a way cleaner way.
Demo here: https://codepen.io/anon/pen/yGEaOm
.calendar {
display: grid;
grid-template-columns: repeat(1, 1fr);
grid-template-rows: 30px repeat(auto-fill, 1fr);
}
/** Appearance styles that don't affect the layout */
.calendar {
min-height: 200px;
}
.day {
border: 1px solid black;
display: flex;
align-items: center;
justify-content: center;
}
<div class="calendar">
<div class="day">
First
</div>
<div class="day">
Second
</div>
</div>