It is a common trick to center text inside div by:
.center-div {
display:table-cell;
vertical-align: middle;
}
The problem is that the text inside my div is some string with variable length and I want the container to be fix height and width. However, when changing the above CSS to this:
.center-div {
display:table-cell;
vertical-align: middle;
width: 100px;
height: 100px;
text-overflow: ellipsis;
}
As it is a table-cell, it simply change the height of the div instead of overflowing. As my text will be a multi-line text, so the line-height trick won't work. Is there a way for me to center text and being able to overflow at the same time?
P.S. A CSS only answer is prefered. The content will be rendered by angularjs and it is impossible to know when the rendering is finished. In case javascript is absolutely needed, please also state a way I can use it together with angularjs. (ng-repeat, to be specific)