floor() rounds a numeric value down to the nearest integer. In responsive CSS Grid layouts, it determines how many repeated tracks fit within the available container width. section 4.4.4
Counting responsive columns
For a 450px container with 10px gaps and 100px tracks, the browser calculates floor((450px − 3 × 10px) / 100px) = floor(4.2) = 4. The grid therefore creates four columns, leaving 50px unused. section 4.4.4
num_repetitions = floor((450px - 3 * 10px) / 100px)
= floor(420px / 100px)
= floor(4.2)
= 4
Follow the calculation from container width and gaps to the final repetition count. section 4.4.4
The same repetition formula supports auto-fill and auto-fit. auto-fill retains empty tracks, while auto-fit collapses them and redistributes their space. section 4.4.4
