CSS Reference ยท Typography
The line-break property
Reference for the CSS line-break property: auto, loose, normal, strict and anywhere. Learn how it changes wrapping, mainly for CJK text, with a live example.
The line-break property sets how strict the browser is when it chooses places to wrap a line. Its main audience is Chinese, Japanese and Korean text, where there are several rule sets about which characters may start or end a line, for example small kana or certain punctuation marks.
One value, anywhere, is useful for every language: it allows a soft wrap opportunity after every character, which makes it a quick way to wrap very long strings in narrow spaces.
.narrow-column { line-break: strict; }
Try it
With auto, the long address cannot be split and pokes out of its box. With anywhere, every character is a possible break point, so the address wraps inside the box.
Syntax
line-break: auto | loose | normal | strict | anywhere;
| Initial value | auto |
| Applies to | all elements |
| Inherited | yes |
| Animatable | no |
| Computed value | as specified |
Values
| Value | Description |
|---|---|
auto |
The browser picks the rule set. It may be less strict for short lines, such as in narrow columns. |
loose |
The least restrictive rules, usually for short lines of text such as newspaper columns. |
normal |
The most common rules for line breaking. |
strict |
The most restrictive rules, for example it forbids breaks before small kana and the prolonged sound mark in Japanese. |
anywhere |
A soft wrap opportunity exists around every typographic character unit, including after punctuation and inside what would normally be a word. No hyphens are added. |
Usage notes
- Latin text is mostly unaffected by
loose,normalandstrict. Onlyanywherevisibly changes English text. - Which Japanese characters are affected depends on the rule sets, so differences between
loose,normalandstrictappear only with specific characters at the edge of a line. Test with real content in the target language. anywhereversusoverflow-wrap: anywhere.overflow-wrapbreaks a word only if it would overflow.line-break: anywheremakes break opportunities everywhere, so ordinary words may also split at the end of a line.anywhereand intrinsic sizes. It affectsmin-contentsizing, so flex and grid items containing such text can shrink more than usual.- Readability. Do not apply
anywhereto whole paragraphs of prose. Reserve it for identifiers, paths and URLs. - Language. Set
langon the content (for examplelang="ja") so the browser uses the right tailoring.
Browser support
All current browsers support the property, but the exact rule sets differ in detail between engines, so check a compatibility table and test CJK content in each one.
Related
word-breakโ allow breaks inside wordsoverflow-wrapโ break words that would overflowhyphensโ hyphenate long wordswhite-spaceโ control wrapping and collapsing- Lesson: Wrapping, Overflow and Hyphens