[Grid] Spacing with negative margins results in sometimes imprecise layouts
See original GitHub issueI am using Grid
to align-right buttons in a Card
. Everything used to look super, but in recent incarnations of material-ui-next, the use of negative margins is resulting in non-ideal presentation with the right negative margin:
The code for this is:
<CardActions>
<Grid container justify="flex-end">
<Grid item>
(buttons)
</Grid>
</Grid>
</CardActions>
Is there a preferred implementation for what I’m trying to achieve here?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
[Grid] Spacing with negative margins results in sometimes ...
I am using Grid to align-right buttons in a Card. ... [Grid] Spacing with negative margins results in sometimes imprecise layouts #10223.
Read more >The Definitive Guide to Using Negative Margins
If the negative margin is equal to the actual width, then it overlaps it entirely. This is because margins, padding, borders, and width...
Read more >WPF: Grid with column/row margin/padding? - Stack Overflow
The idea is simple, use a grid on the outside to pull the margins of elements out of their bounds by half the...
Read more >Flexbox gutters and negative margins, mostly solved - Rawkblog
The issue is the 1rem of margin all around, which creates uneven design and prevents flush sides.
Read more >Negative Stress Margins – Are They Real?
The structural areas where negative margins are frequently encountered are often near stress concentrations, point loads and load discontinuities, near ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@putzisan you can always make your own
Grid
with your own default props and simply search/replace imports. This is a simple 5 minutes or less workaround for you.Now is the time for breaking changes, not post-1.0.
@bluepeter It’s hard to help without a live example of such issue. From your code, you would say that the best option is to use
spacing={0}
.I start to think that it should be the default behavior. The negative margin can really cause trouble. It might not worth having
spacing={8}
by default. cc @mui-org/core-contributors.