Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack: would you use grid over the margin technique described on the stack layout page? #4

Open
NullVoxPopuli opened this issue Oct 30, 2020 · 0 comments

Comments

@NullVoxPopuli
Copy link

Grid seems to be a simpler solution than specifying margins on things.

To me, dealing with margins on the child elements (no matter which class adds them), is like each element "I want this much space, and this is my personal bubble" It gives 0 regard to the other people elements surrounding it.

With Grid, the child elements don't get a say. They are uniformly spaced, no matter how many rows/columns/etc -- all with less CSS.

However, a lot of grid tutorials I see on the web do way more than they should be doing -- messing with grid-areas. I don't know why they do this.
Most of the time all you need is;

display: grid;
grid-gap: 1rem;

for a vertical stack
and

display: grid;
grid-gap: 1rem;
grid-auto-flow: column;

for a horizontal stack.

And then you can also get a consistent 2D grid as well (I mean, this is why Grid is called grid).
when dealing with margins, I think sort of layout gets convoluted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant