# Managing Custom Spacing Between Flexbox and Grid Items with CSS

DevFeed: [Managing Custom Spacing Between Flexbox and Grid Items with CSS](<https://devfeed.tech/articles/self-gap-45378.md>)

Original publisher: [Read original article](<https://ishadeed.com/article/self-gap/>)

Author: Ahmad Shadeed

Published: 2025-03-18T00:00:00Z

Content type: tutorial

Language: en

Sources: [Ahmad Shadeed](<https://devfeed.tech/sources/ahmad-shadeed.md>)

Topics: [CSS](<https://devfeed.tech/topics/css.md>), [layout](<https://devfeed.tech/topics/layout.md>), [Web Development](<https://devfeed.tech/topics/web-development.md>)

Tags: [container](<https://devfeed.tech/tags/container.md>), [css](<https://devfeed.tech/tags/css.md>), [css-variables](<https://devfeed.tech/tags/css-variables.md>), [flexbox](<https://devfeed.tech/tags/flexbox.md>), [grid](<https://devfeed.tech/tags/grid.md>), [layout](<https://devfeed.tech/tags/layout.md>), [margins](<https://devfeed.tech/tags/margins.md>), [spacing](<https://devfeed.tech/tags/spacing.md>)

## AI overview

This tutorial examines ways to create custom spacing between flexbox or grid items. It compares margins, nested containers, and the default flow layout, then demonstrates using CSS variables with a flow utility.

## Source excerpt

Thinking of a way to have a custom gap between some flex or grid items.