Fix the offset handling in the CSS grid (see #5943)