Centering grid items in an auto-fill container

后端 未结 3 1663
野趣味
野趣味 2020-12-30 04:10

I have set up a grid with two items. This grid can contain any number of items but two is enough for this example.

Background

In the example there are two

3条回答
  •  一个人的身影
    2020-12-30 04:44

    That's because of the max value set with minmax is too small.

    You need to set the max value to 50%. Because you have grid-gap:1rem this become calc(50% - 1rem).

    See this fiddle:

    https://jsfiddle.net/1ymkg327/24/

    EDIT:

    I unerstood your question now, and come up with the solution:

    https://jsfiddle.net/1ymkg327/40/

提交回复
热议问题