javascript - hiding extra contents in DIV with following dots -


i need hide text div element following dots (...)

i m using

<div style="width:200px; height:2em; line-height:2em; overflow:hidden;" id="box">  text text text text </div> 

result
hides rest of content overflows div
wants if has hide 3 dots ... should placed @ end else not

output need
text text te...

here's possible solution using text-overflow:ellipsis:

http://jsfiddle.net/fxha3/

.ellipsis {     width:200px;     height:2em;     line-height:2em;     overflow:hidden;     text-overflow:ellipsis;     white-space:nowrap; } 

Comments

Popular posts from this blog

javascript - JS causing window size to be bigger than necessary - Dropdown bug -

How to mention the localhost in android -

php - Calling a template part from a post -