There is currently no way to cross-browser. However, there are some tips you could try:
- Estimate the number of characters that fit into your DIV, crop the text to the desired length and add an ellipse to the end
- You can use the
:after pseudo-element and completely place it in the lower right corner of your DIV
An example of the latter:
HTML:
<div class="ellipsis-div"> <p>Long text Cras justo odio, dapibus ac facilisis in, egestas eget quam. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.<p> </div>
CSS
.ellipsis-div { position: relative; width: 150px; height: 150px; overflow: hidden; } .ellipsis-div:after { position: absolute; display: block; content: "..."; bottom: 0; right: 0; background-color: white; }
You will need to adjust the position of the :after element depending on the height of the DIV line, etc.
source share