[英]CSS cutting text and numbers
I have a large text "desoxyribonucleic" and number 0.4234 or 0.352352523 我有一个较大的文字“ desoxyribonucleic”,编号为0.4234或0.352352523
So I need such format of represent it: 所以我需要这样的格式来表示它:
text: desoxyribon... number: 0.42 number: 0.35 文字:desoxyribon ...数字:0.42数字:0.35
Is it real to roll out this with CSS? 用CSS推出这个工具真的吗? Thanx!
感谢名单!
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. 对于数字,您可以尝试在JavaScript中使用
someNumber.toFixed(2)
,但要注意四舍五入。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.