line-break

您正在阅读此内容的英文版本,因为该语系尚未翻译。 帮助我们翻译此文章吧!

设置 CSS 属性 line-break 可以用来处理如何断开(break lines)带有标点符号的中文、日文或韩文(CJK)文本的行。

/* Keyword values */
line-break: auto;
line-break: loose;
line-break: normal;
line-break: strict;
line-break: anywhere;

/* Global values */
line-break: inherit;
line-break: initial;
line-break: unset;
初始值auto
适用元素all elements
是否是继承属性
适用媒体visual
计算值as specified
Animation typediscrete
正规顺序the unique non-ambiguous order defined by the formal grammar

语法

auto
使用默认的断行规则分解文本。
loose
使用尽可能松散(least restrictive)的断行规则分解文本。一般用于短行的情况,如报纸。
normal
使用最一般(common)的断行规则分解文本。
strict
使用最严格(stringent)的断行原则分解文本。
anywhere

在每个印刷字符单元(typographic character unit)的周围,都有一个自动换行(soft wrap)的机会,包括任何标点符号(punctuation character)或是保留的空白字符(preserved white spaces),或是单词之间。但忽略任何用于阻止换行的字符,即使是来自 GL、WJ 或 ZWJ 字符集的字符,或是由 word-break 属性强制的字符。不同的换行机会拥有相同的优先级。也不应用断字符(hyphenation,可能是 "-")。

英文原文:There is a soft wrap opportunity around every typographic character unit, including around any punctuation character or preserved white spaces, or in the middle of words, disregarding any prohibition against line breaks, even those introduced by characters with the GL, WJ, or ZWJ character class or mandated by the word-break property. The different wrapping opportunities must not be prioritized. Hyphenation is not applied.

正式语法

auto | loose | normal | strict | anywhere

规范

Specification Status Comment
CSS Text Module Level 3
line-break
Working Draft Initial definition

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
line-break
Experimental
Chrome Full support 58
Full support 58
Full support 1
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Edge Full support 14Firefox Full support 69IE Full support 5.5
Full support 5.5
Full support 8
Prefixed
Prefixed Implemented with the vendor prefix: -ms-
Opera Full support 45
Full support 45
Full support Yes
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Safari Full support 3
Prefixed
Full support 3
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
No support 2 — 3
Prefixed
Prefixed Implemented with the vendor prefix: -khtml-
WebView Android Full support 58
Full support 58
Full support ≤37
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Chrome Android Full support 58
Full support 58
Full support 18
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Firefox Android No support NoOpera Android Full support 43
Full support 43
Full support Yes
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Safari iOS Full support 1
Prefixed
Full support 1
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
Samsung Internet Android Full support 7.0
Full support 7.0
Full support Yes
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-

Legend

Full support  
Full support
No support  
No support
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.
Requires a vendor prefix or different name for use.
Requires a vendor prefix or different name for use.