# Flex justify content equally distanced items

DevFeed: [Flex justify content equally distanced items](<https://devfeed.tech/articles/flex-justify-content-equally-distanced-items-37271.md>)

Original publisher: [Read original article](<https://muffinman.io/blog/flex-justify-content-equally-distanced-items/>)

Author: Stanko

Published: 2018-09-07T00:00:00Z

Content type: tutorial

Language: en

Sources: [Stanko Tadić](<https://devfeed.tech/sources/stanko-tadic.md>)

Topics: [Edge](<https://devfeed.tech/topics/edge.md>)

Tags: [display](<https://devfeed.tech/tags/display.md>), [edge](<https://devfeed.tech/tags/edge.md>), [element](<https://devfeed.tech/tags/element.md>), [elements](<https://devfeed.tech/tags/elements.md>), [flex](<https://devfeed.tech/tags/flex.md>), [property](<https://devfeed.tech/tags/property.md>), [simple](<https://devfeed.tech/tags/simple.md>), [works](<https://devfeed.tech/tags/works.md>), [wrapper](<https://devfeed.tech/tags/wrapper.md>)

## AI overview

A CSS flexbox technique uses space-between with empty ::before and ::after pseudo-elements to distribute items evenly, including at the parent's edges. The approach supports dynamic item counts, dynamic widths, and any flex direction, while space-evenly is noted as unsupported in IE and Edge.

## Source excerpt

I want to share a hack (or a trick if you prefer) my colleague Marko showed me today. What is the problem? We want our flex items to be equally distanced between each other and from the parent's edge. Unforunately space-evenlyI wasn't aware of this property, thank you Marc for mentioning it in the comment below. is not supported in IE and Edge. And space-around or space-between won't work. You can see what we are trying to achieve in the first row, and how the latter two are behaving. Trick is really simple, use space-between and add empty pseudo elements (::before and ::after) to the parent element. Pseudo elements have no width, but they are still "pushing" real elements from themselves. .wrapper { display: flex; justify-content: space-between; } .wrapper::before, .wrapper::after { content: ''; } This hack works with dynamic number of elements, dynamic widths and for any flex direction. You can see it in the action below: