固定大小的div不应该将数字分成两半
16lz
2021-01-22
If I have numbers in a sequence, and those numbers are displayed inside div wrapper with fixed size. How can I prevent those numbers to be break on two digits numbers, for example if number is 45 I do not want to break this number to be 4 at the end of first line and 5 on the beggining of the second line.
如果我在序列中有数字,那么这些数字显示在固定大小的div包装器中。如何防止这些数字在两位数字上中断,例如,如果数字为45,我不希望在第一行末尾将此数字分为4,在第二行的开始时分为5。
for example, given sequence numbers are
例如,给定的序列号是
1 2 3 10 20 45 91 92 93 94
if fixed div size has a width to break this numbers I want to break like this
如果固定的div大小有一个宽度来打破这个数字,我想像这样打破
1 2 3 10 20 45
91 92 93 94
and not
并不是
1 2 3 10 20 4
5 91 92 93 94
2 个解决方案
#1
3
Use word-break
使用分词
#content{
width: 45px;
word-break: keep-all;
}
<div id="content">1 2 3 10 20 45 91 92 93 94</div>
更多相关文章
- NodeJS - 解析JSON(只有字符串或数字)
- 使用CSS,HTML和Javascript在随机图像的页面上进行图像大小调整
- Jquery UI draggable不会调整其他DIV的大小
- 如何获得mp3文件的大小和持续时间?
- 使数字成为另一个数字的因素(性能问题)
- 什么是一个很好的JS库,可以调整大小?
- req.files.upload.length返回文件计数为零,或上传多个文件,当一个
- 谷歌映射API v3: InfoWindow大小不正确
- 如何在HTML页面中维护SWF文件的大小?