Reputation: 685
I have a large text "desoxyribonucleic" and number 0.4234 or 0.352352523
So I need such format of represent it:
text: desoxyribon... number: 0.42 number: 0.35
Is it real to roll out this with CSS? Thanx!
Upvotes: 2
Views: 333
Reputation: 324780
Yup!
.ellipsis {
max-width: 100px; /* adjust as needed */
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis; /* magic happens here */
}
For numbers, you can try using someNumber.toFixed(2)
in JavaScript, just be careful of rounding.
Upvotes: 3