Can grid-row-gap / grip-column-gap be overridden for a single gutter?

佐手、 提交于 2019-12-03 20:39:00

问题


Is there a way to set a single grid-row-gap to specific size that is different from the rest of the grid?

Use case: the top row of the grid should have less of a gap to the second row than the rest of the grid as it acts as a header.


回答1:


The grid-row-gap and grid-column-gap properties apply to the entire grid (spec reference).

However, you can use negative margins on the second row grid items to adjust their position.

Another option would be to remove the top row (headers) from the current grid and place it in a different container directly above the data. This would eliminate the grid-gap problem.



来源:https://stackoverflow.com/questions/45151767/can-grid-row-gap-grip-column-gap-be-overridden-for-a-single-gutter

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!