Fit height to background pattern size with calc-size()

Title “Fit height to background pattern size with calc-size()”, author’s photo, “Ahmad Shadeed, Design Engineer”, and two “The Espresso Guide” cards on a pizza slice pattern.

Ahmad Shadeed has a section where a pattern tiled on both axes gets cut off at the bottom. Using background-repeat: round helps but stretches or shrinks the tiles. Instead, height: calc-size(auto, round(up, size, var(--tile-height))) takes the content height and rounds it up to the nearest multiple of the tile height. The same round() keeps padding-block in step with the pattern. Chrome-only for now.

ishadeed.com/article/fit-height-background-pattern-calc-size