I have been attempting to use flexbox for this, but any other css-only solution would be acceptable.
I want all items along a row to expand to the width of the largest item, so the result is identical widths. However, at the same time without the parent element expanding beyond the minimum size needed to accomplish this.
If you look at my Codepen example, altering the flex-grow value on <ul>
elements will make this work for some of the demo examples, but not all.
http://codepen.io/MattyBalaam/pen/VepxWq
div {
display: flex;
justify-content: center;
}
ul {
display: flex;
justify-content: center;
padding: 0 0 2em;
flex-grow: 0.15;
}
li {
list-style: none;
margin: 2em;
flex: 1 1 0;
}
<div>
<ul>
<li>1</li>
<li>2</li>
<li>----3----</li>
</ul>
</div>