To work text-overflow: ellipsis , you must have a certain width. You have flex-basis: auto , which is not enough.
In addition, text-overflow: ellipsis only works with block-level elements.
The flex element is considered locked and the ellipsis will work. However, you also apply display: flex to display: flex elements, which violates the block level rule for the display property.
Try the following settings:
ul { display: flex; height: 40px; margin: 0; padding: 0; width: 100%; list-style: none; } ul li { height: 100%; padding: 0 4px; border-bottom: 1px solid #eee; } ul li:first-child { width: 55px; flex-shrink: 0; } ul li:first-child input { width: 100%; } ul li:last-child { width: 48px; flex-shrink: 0; } ul li:nth-child(2) { flex: 0 1 100px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0px; } ul li:nth-child(3) { width: 75px; flex-shrink: 0; }
<ul> <li><input type="number" value="1"></li> <li>A very long text description goes here</li> <li>$99.90</li> <li>Del</li> </ul>
Revised script
To vertically center the text, you can use the flexible layout for elements with non-ellipsis, as before. To vertically center the ellipsis text, try a different method .
Literature:
source share