未记录的分词:分词 CSS 属性?

Undocumented word-break: break-word CSS property?

我们希望避免长词溢出行,并在必要时让它们被打断,标准方法是

word-wrap: break-word

或其等效物

overflow-wrap: break-word

但是,我们发现这不适用于 Safari(包括 Mac 和 iOS)。

然后我们无意中发现word-breakCSS属性,本来应该只接受break-all的值,意思是什么地方都断,显然采用 break-word 的未记录值(Chrome 也接受此值),并且以下

word-wrap:  break-word;
word-break: break-word;

似乎解决了 Safari 上的问题。

我无法在 Web 上找到任何对 word-break 的非标准 break-word 值或任何具有 word-wrap: break-word 的 Safari "bugs" 的引用使用 word-break: break-word 可以解决。

据我所知,word-break: break-word; 是非标准的,仅限 webkit。可以在 Safari CSS Reference

上找到

word-break Specifies the level of strictness when breaking lines of text in ideographic languages such as Chinese, Japanese, and Korean.

Syntax word-break: strictness Parameters strictness The level of strictness. Constants break-all, break-word, normal Availability Available in Safari 3.0 and later. Available in iOS 2.0 and later. Support Level Stable CSS 3.

word-break: break-word 已正式弃用。

来自CSS Text Module Level 3 Working Draft

For compatibility with legacy content, the word-break property also supports a deprecated break-word keyword. When specified, this has the same effect as word-break: normal and overflow-wrap: anywhere, regardless of the actual value of the overflow-wrap property.

如果您喜欢 word-break: break-word 所做的事情(我也喜欢!),您应该改用 word-break: normaloverflow-wrap: anywhere(然后您可以尝试进一步更改它们中的每一个如果你喜欢)