Skip to content

Rationale behind negative right/left margins for Grid component #3074

Answered by SiTaggart
mannehedlund asked this question in General
Discussion options

You must be logged in to vote

Hi @mannehedlund

The main reason if for nesting grids. The new nested grid should still have gutters attached, but the columns should touch the outer wall of the parent column. If you use padding on the grid container you'll indent the child grid.

It's a very popular and common way to create grid systems on the web.

Is it great? No. Better solutions exist in CSS now with CSS grid, which we support on the Box component. We've just not been able to prioritize a CSS Grid version of the Grid Component yet. It's on our wish list, though.

In the meantime, if the negative margins don't work for you, I'd suggest just going with Box and using the CSS grid style props we provide.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mannehedlund
Comment options

Answer selected by mannehedlund
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants