line-break CSS property sets how to break lines of Chinese, Japanese, or Korean (CJK) text when working with punctuation and symbols.

/* 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

Break text using the default line break rule.

loose

Break text using the least restrictive line break rule. Typically used for short lines, such as in newspapers.

normal

Break text using the most common line break rule.

strict

Break text using the most stringent line break rule.

anywhere

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
适用于 所有元素
继承 yes
计算值 如指定
动画类型 discrete

形式句法

auto | loose | normal | strict | anywhere
					

范例

Setting text wrapping

See whether the text is wrapped before "々", "ぁ" and "。".

HTML

<div lang="ja">
  <p class="wrapbox auto">auto:<br>そこは湖のほとりで木々が輝いていた。<br>その景色に、美しいなぁと思わずつぶやいた。</p>
  <p class="wrapbox loose">loose:<br>そこは湖のほとりで木々が輝いていた。<br>その景色に、美しいなぁと思わずつぶやいた。</p>
  <p class="wrapbox normal">normal:<br>そこは湖のほとりで木々が輝いていた。<br>その景色に、美しいなぁと思わずつぶやいた。</p>
  <p class="wrapbox strict">strict:<br>そこは湖のほとりで木々が輝いていた。<br>その景色に、美しいなぁと思わずつぶやいた。</p>
  <p class="wrapbox anywhere">anywhere:<br>そこは湖のほとりで木々が輝いていた。<br>その景色に、美しいなぁと思わずつぶやいた。</p>
</div>
					

CSS

.wrapbox { width: 10em; margin: 0.5em; white-space: normal; vertical-align: top; display: inline-block; }
.auto { line-break: auto; }
.loose { line-break: loose; }
.normal { line-break: normal; }
.strict { line-break: strict; }
.anywhere { line-break: anywhere; }
					

结果

规范

规范 状态 注释
CSS Text Module Level 3
The definition of 'line-break' in that specification.
工作草案 初始定义

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
line-break Chrome 完整支持 58 Edge 完整支持 14 Firefox 完整支持 69 IE 完整支持 5.5
完整支持 5.5
完整支持 8 Prefixed
Prefixed Implemented with the vendor prefix: -ms-
Opera 完整支持 45 Safari 完整支持 11
完整支持 11
Prefixed Implemented with the vendor prefix: -webkit-
不支持 2 — 3 Prefixed
Prefixed Implemented with the vendor prefix: -khtml-
WebView Android 完整支持 58 Chrome Android 完整支持 58 Firefox Android 不支持 No Opera Android 完整支持 43 Safari iOS 完整支持 11 Samsung Internet Android 完整支持 7.0

图例

完整支持

完整支持

不支持

不支持

要求使用供应商前缀或不同名称。

要求使用供应商前缀或不同名称。

元数据

  • 最后修改: