I'm out of ideas. Maybe anybody knows how to solve this?
- all divs must be equally spaced.
- div1, div2 unknown width;
- div2 must be in the center;
- div3 can be empty or not.
div div {
background: pink;
border: 1px solid #ccc;
}
<div style="display:flex;justify-content:space-between">
<div class="d1">div1</div>
<div class="d2">div2</div>
<div class="d3"></div>
</div>
Problem:
div2 is not horizontally centered
Comment on accepted answer:
The only way i managed to solve it was:
div2 { width: 200px}
div1, div3 { width: calc((100% - 200px)/2) }