I'm trying to add a gradient to past days in a calendar, but the gradient lines not aligning look a bit meh.
div.month {
flex: 1 1 auto;
display: grid;
grid-gap: 1px;
grid-template-columns: repeat(7, 1fr);
background-color: var(--color-border);
}
div.day {
background-color: var(--color-fill);
}
div.day + .past {
background: repeating-linear-gradient(
-45deg,
var(--color-fill),
var(--color-fill) 1.5rem,
var(--color-gradient-calendar-past) 1.5rem,
var(--color-gradient-calendar-past) 3rem
);
}
<div class="month noselect">
<div class="day void"><div class="day-number"></div></div>
<div class="day past"><div class="day-number">1</div></div>
<div class="day past"><div class="day-number">2</div></div>
<div class="day past"><div class="day-number">3</div></div>
<div class="day past"><div class="day-number">4</div></div>
...
<div class="day today"><div class="day-number">17</div></div>
Without making the days square (aspect-ratio: 1/1
), is it possible to align these gradients?
I was thinking maybe I can make the whole component's background that gradient, but then I run into the same problem if I want to use the same gradient coloured differently on other days.