DEV Community

Discussion on: Three neat CSS features

Collapse
 
bennypowers profile image
Benny Powers 🇮🇱🇨🇦

Very cool. I've often used margin-left for gaps in (row) flex containers before

.flex-row :not(:first-child) {
  /* specify a value or use auto to create a flexible spacer */
  margin-left: var(--flex-gap, auto)
}
Collapse
 
tplk profile image
Dmitry Teplov

It's probably better to set margin for all sides & negative margin on flex container so gaps are displayed correctly when flex children are wrapped to another row.
codepen.io/tplk/pen/wEZbxM