There is a grid with many small rows and columns, something like this:
Items will be placed inside it, for example:
Grid is created with something like:
grid-template-rows: repeat(auto-fill, 10px);
grid-template-columns: repeat(auto-fill, 10px);
- Width of the grid can be as wide as browser window, say 2000px.
- Height can be a multiple screens, say 10000px.
- Tracks are not visible to the user, above images are just to demonstrate how CSS Grid layout looks.
- There can be hundreds of "items" (grey areas on above image), each occupying some number of cells (it can be 1x1 item, and it can be 60x40 item)
Questions
- Is this a performance concern? Is it expensive for browsers to generate grid with a few hundred columns and a few thousand rows?
- If yes, is there a way to optimize
repeat(auto-fill, 10px)
? Maybe percentages should be used instead (repeat(auto-fill, 1%))
, or something instead ofauto-fill
?
Or it's better doing this via JavaScript (height to container, left/top to items)?