小编sup*_*iya的帖子

How to make a grid container shrink to fit the content?

I'm trying to make a game with a grid. I have x divs with x divs inside them, to create the grid.

The problem is that I want the container div for all of this to only be as big as it needs to be (say, 5x5 squares at 25px each = 125px x 125px container div). The height is fine, but the width stretches to the end. Each box is to be 25px.

I've tried grid-template-rows: repeat(auto-fill, 25px) which …

html css flexbox css-grid

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

css ×1

css-grid ×1

flexbox ×1

html ×1