I have a flex ul
with three li
. The first and last li
have contents of unknown and possibly differing length. The middle li
should have its contents centered in the middle of the ul
.
Is there any way to accomplish this with pure HTML/CSS?
ul {
display: flex;
width: 250px;
padding: 0;
}
li {
margin: 0;
padding: 0;
list-style-type: none;
white-space: nowrap;
border: 1px solid blue;
}
li:first-of-type {
flex: 0;
}
li:not(:first-of-type):not(:last-of-type) {
flex: 1;
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
}
li:last-of-type {
flex: 0;
text-align: right;
}
<ul>
<li>Some Options</li>
<li>Some long Title</li>
<li>Done</li>
</ul>