![]() Unfortunately `text-overflow` doesn't work on multiple lines of text.Īnd the `white-space: nowrap ` turn multiple lines into one single line. Normally, the following would be used to add ellipsis: It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. The above code results in A quick brown fox jumps. There a JavaScript solution might be ideal in some cases. for truncating multi line texts using cross-browser CSS strategies. Truncating multiple line text using pure CSS can be done, however, it has some caveats. To make text overflow its container, you have to set other CSS properties: overflow and white-space. Truncating single line text followed by an ellipsis The is a very common and widely used scenario and it has a standard CSS implementation. Shave is a javascript plugin that truncates multi-line text within a html element. Because CSS has no property for ellipsis on multiline text, various workarounds have been created. The text-overflow property doesnt force an overflow to occur. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. Truncating multiple line text using pure CSS can be done, however, it has some caveats. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself. Responsive Multi-line Text Truncating In Pure JavaScript Ellipsis.js Ellipsis.js is a pure JavaScript library for responsive text truncation which enables you to truncate multi-line text within a specified DOM element (s) with ellipsis. Return element.scrollHeight > element.Pure CSS multiline text-overflow:elipsis solution You can apply CSS to your Pen from any stylesheet on the web.
0 Comments
Leave a Reply. |