[CSS Tip ] Use 'gap' property with Flexb ...

[CSS Tip ] Use 'gap' property with Flexbox

Mar 11, 2025

image

I've noticed lately that some devs use margin to add gaps/gutters between flexbox items, particularly in website menus.

You can use gap property in Flexbox instead and avoid awkward :not(:last-child) hack or resetting margin on first/last item. 😉

 It's in the baseline since April 2021. ✅

Подобається цей допис?

Купити для CSS Weekly каву

Більше від CSS Weekly