Reputation: 45
I have div tag with fixed height. in it there is anchor tag < a> tag. when text in anchor tag exceeds width of div it comes in 2 lines in div tag. Due height of div tag second line is displayed half. so how to use text-overflow :ellipsis so that ellipsis will be displayed and with which tag? please help. Thanx in advance
Upvotes: 1
Views: 2065
Reputation: 2060
If you just need a single line of text, you can set the white-space
CSS property to nowrap
. The complete CSS will look as follows:
div {
width: 75px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
Check this fiddle: http://jsfiddle.net/yXgQT/
Upvotes: 3