HTML
<span class="truncate">Here is a long text information.</span>
CSS
SPAN.truncate { width: 100px; overflow: hidden; white-space: nowrap; text-align: left; }
Sometimes you may need to cut text from left side to get something like "...a long text information". This is easy to do using the "direction: rtl" CSS property. Add another class which will define alternate truncation side:
CSS
SPAN.truncate.left { direction: rtl; }
Usage for the above CSS class:
<span class="truncate left">Here is a long text information.</span>
No comments:
Post a Comment