text-overflow
only works when the overflow
property is different from visible
.
In addition, max-width
not applied to unoccupied inline elements ( spec ), by default span
. Example working code:
.ellipsis { max-width: 3em; display: inline-block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
Now apply the class to the element:
<div ng-repeat="your loop directive"> <span class="ellipsis">{{something}}</span> </div>
Demo
source share