DEV Community

Jérôme Pott
Jérôme Pott

Posted on

5

Flexbox space-evenly value

Using the space-evenly value with Flexbox

You have certainly already used the space-around and space-evenly values of the Flexbox properties justify-content and align-items.

But did you know that you have one extra option?

Meet thespace-evenly value. This "new" value is similar to space-around but provides equal instead of half-sized space on the edges.

space-around
space-around

space-evenly
space-evenly

Microsoft Edge

In Microsoft Edge, the space-evenly value is currently only supported in CSS grid. But here is a possible workaround with a fallback to the space-around value:

.space-evenly {
  justify-content: space-evenly;
}

@supports (-ms-accelerator: true) {
  /* Edge only */

  .space-evenly {
    justify-content: space-around;
    /* you can also add some other adjustments to size, margins etc to get the same positioning */
  }
}
Enter fullscreen mode Exit fullscreen mode

Sources:
https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/15947692/
https://caniuse.com/#search=space-evenly
https://cssreference.io/property/justify-content/

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (1)

Collapse
 
desoga profile image
deji adesoga • Edited

I think this Website contains almost, if not all the values of css flex box. It's also a practical way of viewing the features in real time.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay