I managed to snap the with of an element to multiple of 100.
:root{--unit:100px;}
.grid{
display:grid;
gap:0;
grid-template-columns: repeat( auto-fill, var(--unit) );
}
.grid-content { outline:4px solid #ccc; grid-column: 1 / -2; }
How can I get the same in vertical (element height). It hasn't to be grid, it can be whatever, as long it'not JS. Here ist the pen: https://codepen.io/szopos/pen/ZEXBWrg
snappedHeight = Math.ceil(elHeight / 100) * 100
– Anthemion