定义换行的首选位置

问题描述 投票:0回答:1

有没有什么方法,最好使用CSS,在整个文本不会分成超过2行的情况下定义换行的首选位置?

比方说,我们有一个这样的句子:

This is the rather lengthy main clause, but here's a sub clause.

我想在逗号处断开句子。

但如果没有足够的水平空间,我不想让它分成第三行。在这种情况下,我的强制换行应该被忽略。

// wide screen (perfect):

| This is the rather lengthy main clause,                 |
| but here's a sub clause.                                |


// narrow screen (bad):

| This is the rather lengthy main  |
| clause,                          |
| but here's a sub clause.         |


// narrow screen (good):

| This is the rather lengthy main  |
| clause, but here's a sub clause. |

我该怎么办?

javascript html css
1个回答
0
投票

因为没有代码,所以无法帮助您。但这就是其背后的直觉。

如果是静态文本,最好将打破

comma(,)
的条件放在网页视图上,然后让它在移动屏幕上运行。

© www.soinside.com 2019 - 2024. All rights reserved.