[英]CSS word-break: break-all; (only for long words)?
Based on: https://www.w3schools.com/cssref/css3_pr_word-break.asp 基于: https : //www.w3schools.com/cssref/css3_pr_word-break.asp
Is there any way the example at: https://www.w3schools.com/cssref/tryit.asp?filename=trycss3_word-break 有什么办法可以在以下示例中找到示例: https : //www.w3schools.com/cssref/tryit.asp?filename=trycss3_word-break
can give the following: 可以给出以下内容:
Thisissomeveryveryv
erylong word. This
text will break at
any character.
rather than: 而不是:
Thisissomeveryveryv
erylong word. This te
xt will break at any ch
aracter.
? ?
In other words only break single long words that are wider than the container allows (eg 140px) else wrap them to another line if they overflow. 换句话说,只能破坏比容器允许的宽度长的单个长字(例如140px),如果溢出,则将它们包装到另一行。
I think you're looking for word-break: break-word;
我认为您正在寻找
word-break: break-word;
or overflow-wrap: break-word;
或
overflow-wrap: break-word;
. 。 Here's how MDN Web Docs describes
break-word
: 这是MDN Web文档描述
break-word
:
To prevent overflow, normally unbreakable words may be broken at arbitrary points if there are no otherwise acceptable break points in the line.
为了防止溢出,如果行中没有其他可接受的断点,则通常会在任意点处打断牢不可破的单词。
The page goes on to note that it is not supported in Firefox and Internet Explorer. 该页面继续指出,Firefox和Internet Explorer不支持该页面。
The Caniuse reference for word-break
notes that break-word
is unofficial and treated like overflow-wrap: break-word;
Caniuse
word-break
参考指出break-word
是非官方的,并且像overflow-wrap: break-word;
一样对待overflow-wrap: break-word;
( overflow-wrap
is a synonym of word-wrap
). (
overflow-wrap
是word-wrap
的同义词)。
As it so happens, overflow-wrap
seems to have pretty good support, so you'd probably be better off with that instead. 碰巧的是,
overflow-wrap
似乎有很好的支持,所以您可能会选择更好的选择。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.