Using justify-content: space-between with an invisible flex item, as described in your question, is a good way to achieve the layout you want. Just note that the middle item can only be centered if both left and right items are equal length (see demo).

Another solution you may want to consider involves auto margins and absolute positioning. Two benefits of this method are no need for extra mark-up and true centering can be achieved regardless item sizes. One drawback is that the centered item is removed from the document flow (which may or may not matter to you).

.flexcontainer {
  display: flex;
  justify-content: flex-start;
  /* adjustment */
  position: relative;
  /* new */
  width: 500px;
  height: 200px;
}

.itemcenter {
  flex: 0 1 auto;
  width: 150px;
  height: 100px;
  position: absolute;
  /* new */
  left: 50%;
  transform: translateX(-50%);
}

.itemright {
  flex: 0 1 auto;
  width: 100px;
  height: 100px;
  margin-left: auto;
  /* new */
}
<div class="flexcontainer">
  <div class="itemcenter">One</div>
  <div class="itemright">Other</div>
</div>

More details here: Methods for Aligning Flex Items along the Main Axis (see boxes #62-78).

Answer from Michael Benjamin on Stack Overflow
🌐
Oregoom
oregoom.com › home › css align-items
▷ CSS Align-items → 【 How to use in CSS 】
October 21, 2024 - The CSS property align-items is used to align items within a flex container (elements with the display: flex property set) along the cross axis, which is the vertical axis (top-bottom) by default.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › CSS › Reference › Properties › align-items
align-items - CSS | MDN
The flex items' margin boxes are centered within the line on the cross-axis. If the cross-size of an item is larger than the flex container, it will overflow equally in both directions. ... The items are packed flush to each other toward the start edge of the alignment container in the appropriate axis.
Discussions

CSS Flexbox - how to center align all items
Hi I’m trying to create 2 rows of elements. I want each row to have 2 images. Each image needs to have a label underneath. I managed to center the images but the labels all fall to the left. How do I center the labels? My code Thanks! More on forum.freecodecamp.org
🌐 forum.freecodecamp.org
1
1
June 9, 2018
html - How to center-align one flex item and right-align another using Flexbox - Stack Overflow
I am totally new to Flexbox and wanted to align buttons, but I could not see how to handle the common case with a center-aligned button and a right-aligned button on the same row using only Flexbox. More on stackoverflow.com
🌐 stackoverflow.com
Why isn’t “align-items: center” not working here?
height:100% doesn't work in that way for static elements. You should: Define the height/min-height for the main Growing the main using flexbox Using position (for this example I don't recommend this option) More on reddit.com
🌐 r/css
7
7
September 22, 2024
Confused about align-content, align-items, justify-content, justify-items???
In particular for flexbox the Flexbox Froggy game is a very neat teaching tool. More on reddit.com
🌐 r/webdev
14
21
May 7, 2021
🌐
Infoheap
infoheap.com › home › tutorials › css › css properties › css3 flexbox
CSS align-items - flexbox items vertical alignment - InfoHeap
In the following code, CSS property align-items can be changed to the following values · auto · flex-start · flex-end · center · baseline · stretch ·
🌐
W3Schools
w3schools.com › cssref › css3_pr_align-items.php
CSS align-items property
❮ Previous Complete CSS Reference ... · More "Try it Yourself" examples below. The align-items property specifies the default alignment for items inside a flexbox or grid container....
🌐
freeCodeCamp
forum.freecodecamp.org › html-css
CSS Flexbox - how to center align all items - HTML-CSS - The freeCodeCamp Forum
June 9, 2018 - Hi I’m trying to create 2 rows of elements. I want each row to have 2 images. Each image needs to have a label underneath. I managed to center the images but the labels all fall to the left. How do I center the label…
🌐
Tailwind CSS
tailwindcss.com › docs › align-items
align-items - Flexbox & Grid - Tailwind CSS
Use the items-start utility to ... class="py-12">02</div> <div class="py-8">03</div></div> Use the items-center utility to align items along the center of the container's cross axis:...
Find elsewhere
🌐
DigitalOcean
digitalocean.com › community › tutorials › css-centering-using-flexbox
Centering Things in CSS Using Flexbox | DigitalOcean
May 2, 2020 - justify-content: center; } .box { padding: .5rem; height: 300px; box-shadow: 2px 2px 5px rgba(0,0,0,0.03); border-radius: 4px; color: #84613D; font-family: "Lucida Console", Monaco, monospace; background: #FDF9EA; border-bottom: 1px solid #F9F2D6; border-right: 1px solid #F9F2D6; } .box p { max-width: 125px; text-align: center; background: rgba(255,255,255,0.5); margin: .25rem; padding: .25rem; } The power of Flexbox really shines when we also need to center elements vertically. Here’s our example, but with the flex items also centered vertically: .box.flex { display: flex; justify-content: center; align-items: center; } arrr!
🌐
W3Schools
w3schools.com › css › css_align.asp
CSS Center Align
With CSS, you can center elements ... a div element using flexbox: .center { display: flex; justify-content: center; align-items: center; } Try it Yourself » ·...
🌐
Bootstrap Shuffle
bootstrapshuffle.com › classes › flexbox › align-items-*-center
align-items-*-center - Bootstrap CSS class
<div class="d-flex align-items-center"> <div class="p-2">Flex item 1</div> <div class="p-2">Flex item 2</div> <div class="p-2">Flex item 3</div> </div> <!-- responsive variations --> <div class="d-flex align-items-sm-center">...</div> <div class="d-flex align-items-md-center">...</div> <div class="d-flex align-items-lg-center">...</div> <div class="d-flex align-items-xl-center">...</div>Copy code ... You don't need to remember all CSS classes.
🌐
WebPlatform
webplatform.github.io › docs › css › properties › align-items
align-items · WebPlatform Docs
CSS Object Model Property · alignItems · align-items: baseline · align-items: center · align-items: flex-end · align-items: flex-start · align-items: stretch · box-align: after · box-align: baseline · box-align: before · box-align: middle · box-align: stretch ·
🌐
CSS-Tricks
css-tricks.com › almanac › properties › a › align-items
align-items | CSS-Tricks
April 19, 2025 - The align-items property accepts ... margin edge of the items is placed on the cross-end line · center: items are centered in the cross-axis ·...
🌐
Twelve
xedapkhongyen.com › blog › center-align-things-with-css
Center aligning content with CSS and flex-box | Twelve
Suppose you want to align a div horizontally to the center of the parent element. Then you need to apply the display: flex; align-items: center; justify-content: center; properties to the parent element.
🌐
Mimo
mimo.org › glossary › css › align-items
CSS align-items property: Syntax, Usage, and Examples
The align-items CSS property controls how flex or grid items line up on the cross axis inside a container. Use it to align items at the top, center, bottom, or stretch them to fill available space.
🌐
DEV Community
dev.to › adiatiayu › css-flexbox-align-items-96k
CSS Flexbox: align-items - DEV Community
January 16, 2021 - It aligns the items vertically on the center of the flex container.
🌐
DEV Community
dev.to › elijahtrillionz › how-to-center-align-items-in-css-with-4-solid-methods-31c3
How to Center Align Items in CSS with 4 Solid Methods. - DEV Community
June 13, 2021 - There are different ways to center align texts and elements in CSS, but not all of it will work for all elements, for example · One of the common ways to align items to the center is text-align: center;. Now try this CSS declaration on a div ...
🌐
GeeksforGeeks
geeksforgeeks.org › css › css-align-items-property
CSS align-items Property - GeeksforGeeks
July 11, 2025 - The align-items: center value vertically centers flex items along the container's cross-axis, aligning them in the middle.
🌐
Bootstrap
getbootstrap.com › docs › 5.3 › utilities › flex
Flex · Bootstrap v5.3
Use justify-content utilities on flexbox containers to change the alignment of flex items on the main axis (the x-axis to start, y-axis if flex-direction: column). Choose from start (browser default), end, center, between, around, or evenly.
🌐
Bennadel
bennadel.com › blog › 3394-css-flexbox-aligning-content-slightly-off-center.htm
CSS Flexbox: Aligning Content Slightly Off-Center
April 22, 2020 - Ben Nadel demonstrates how to use the flexible box model in CSS to keep content slightly off-center (for design purposes). He does this with the help of "spacer" elements that have proportional flex-basis percentages.
🌐
Bootstrap
getbootstrap.com › docs › 4.0 › utilities › flex
Flex · Bootstrap
... Use align-content utilities on flexbox containers to align flex items together on the cross axis. Choose from start (browser default), end, center, between, around, or stretch.