Hacker News new | ask | show | jobs
by paraph1n 1757 days ago
> I think gap is where this is all headed in the long term.

gap? Is this new? I've been waiting for years for CSS to finally support something like that. Always thought it was weird that I had to mess with margins (and last-child hacks) to get a proper gap between items in a container.

2 comments

It's part of CSS grid so in a way it's new, but CSS grid well supported nowadays.
It's been made more general than just grid (it used to be called grid-gap) and works with flexbox too. I don't know if Safari supports it in flexbox yet and it's a pain to detect with @supports because Safari _does_ support gap but in a different context, but it works fine in Chrome and Firefox.

Edit: just checked, Safari 14.1 added support for using gap with Flexbox.