CSS line-break Property

The CSS line-break property controls how strictly line-breaking rules are applied to text, particularly Chinese, Japanese, and Korean (CJK) characters and punctuation.

It determines which line-break opportunities are permitted or prohibited around certain characters. The property is useful for multilingual websites, East Asian typography, and layouts where punctuation must follow language-specific line-breaking conventions.

line-break Syntax

The line-break property accepts one of five keywords that control the strictness of line-breaking rules.

Basic Syntax

selector {
  line-break: strict;
}

Available Values

.text {
  line-break: auto;
}
.text {
  line-break: loose;
}
.text {
  line-break: normal;
}
.text {
  line-break: strict;
}
.text {
  line-break: anywhere;
}

CSS-Wide Keywords

.text {
  line-break: initial;
}
.text {
  line-break: inherit;
}
.text {
  line-break: unset;
}
.text {
  line-break: revert;
}
.text {
  line-break: revert-layer;
}

The initial value is auto. The property does not accept lengths, percentages, or numerical values.

Property Values

Each keyword controls how the browser determines acceptable line-break opportunities.

Value Description
auto Allows the browser to choose an appropriate set of line-breaking rules.
loose Uses less restrictive line-breaking rules, suitable for short lines where additional break opportunities are useful.
normal Uses the normal set of line-breaking rules for the writing system.
strict Uses stricter line-breaking rules, particularly around East Asian punctuation and small characters.
anywhere Allows breaks around typographic character units, including opportunities otherwise prohibited by some line-breaking restrictions, while preserving required character integrity.
initial Resets the property to auto.
inherit Uses the computed value from the parent element.
unset Uses the inherited value because the property is inherited.
revert Reverts the property according to cascade origin rules.
revert-layer Reverts the property according to cascade layer rules.

Property Characteristics

Characteristic Value
Initial value auto
Inherited Yes
Applies to Text elements
Computed value Specified keyword
Animation type Discrete
Percentages Not applicable
Primary purpose Control line-breaking rules for text
Primary writing systems Chinese, Japanese, and Korean

The property primarily affects punctuation and character combinations used in East Asian typography. For ordinary English text, changing the value may produce little or no visible difference.

How It Works

When text reaches the available width of its container, the browser determines where a line may break. These decisions depend on the writing system, punctuation, whitespace, and CSS text properties.

The line-break property adjusts the set of permitted break opportunities.

Default Line Breaking

.text {
  line-break: auto;
}

The browser selects appropriate rules for the text.

More Restrictive Breaking

.text {
  line-break: strict;
}

The browser applies stricter restrictions around certain punctuation marks and characters.

Less Restrictive Breaking

.text {
  line-break: loose;
}

The browser permits additional break opportunities where the loose line-breaking rules allow them.

Allow More Break Opportunities

.text {
  line-break: anywhere;
}

This value allows more aggressive breaking around typographic character boundaries.

Important Consideration

The property controls where breaks are allowed, not where they must occur. Actual line breaks still depend on available width, font metrics, and other text layout settings.

auto Value

The auto value allows the browser to choose the appropriate line-breaking rules.

Basic Example

.text {
  line-break: auto;
}

Japanese Text

<p lang="ja" class="japanese-text">日本語の文章を表示します。</p>
.japanese-text {
  line-break: auto;
}

Chinese Text

<p lang="zh" class="chinese-text">这是一个中文排版示例。</p>
.chinese-text {
  line-break: auto;
}

Important Consideration

The browser may choose different behavior based on language information and its text layout implementation. Use an explicit value when a particular line-breaking policy is required.

loose Value

The loose value applies less restrictive line-breaking rules. It can be useful for short lines, narrow columns, and compact interfaces.

Basic Example

.text {
  line-break: loose;
}

Narrow Text Container

.narrow-text {
  max-width: 180px;
  line-break: loose;
}

Japanese Text

<p lang="ja" class="compact-text">これは日本語の文章です。小さな画面でも読みやすく表示します。</p>
.compact-text {
  line-break: loose;
}

Short Lines

Loose breaking can help reduce awkward spacing or overflow when the available inline space is limited.

Important Consideration

The exact differences between loose and other values depend on the language, characters, and browser. Not every text sample will show a visible difference.

normal Value

The normal value applies the standard line-breaking restrictions for the writing system.

Basic Example

.text {
  line-break: normal;
}

Japanese Paragraph

.japanese-paragraph {
  line-break: normal;
}

Chinese Paragraph

.chinese-paragraph {
  line-break: normal;
}

Normal vs. auto

normal explicitly requests the normal set of rules. auto allows the browser to select a suitable rule set, which may produce different results.

Important Consideration

Use normal when you want standard line-breaking behavior without the additional restrictions of strict or the relaxed rules of loose.

strict Value

The strict value applies stricter restrictions on line breaks, particularly around punctuation and small characters in East Asian text.

Basic Example

.text {
  line-break: strict;
}

Japanese Typography

<p lang="ja" class="strict-japanese">これは日本語の文章です。句読点の位置を適切に処理します。</p>
.strict-japanese {
  line-break: strict;
}

Punctuation Handling

Strict rules prevent additional types of punctuation and small characters from appearing in inappropriate positions at the beginning or end of a line.

Longer Lines

Because fewer break opportunities may be available, strict breaking can produce different line lengths and wrapping patterns.

Important Consideration

Use strict when typography needs to follow stricter East Asian line-breaking conventions. It does not guarantee that every line will have the same length.

anywhere Value

The anywhere value permits additional line breaks around typographic character units, overriding many normal line-breaking restrictions.

Basic Example

.text {
  line-break: anywhere;
}

Narrow Container

.narrow-text {
  width: 120px;
  line-break: anywhere;
}

Mixed-Language Text

<p class="mixed-text">日本語とEnglishを組み合わせた文章です。</p>
.mixed-text {
  line-break: anywhere;
}

Character Integrity

Even with anywhere, browsers must preserve required character boundaries and avoid breaking within indivisible typographic units.

Important Consideration

The anywhere value of line-break is not identical to overflow-wrap: anywhere. The properties address different parts of the line-breaking process.

CJK Typography

Chinese, Japanese, and Korean writing systems have line-breaking conventions that differ from those used in English text.

Chinese Text

<p lang="zh">这是一个用于演示中文换行规则的段落。</p>

Japanese Text

<p lang="ja">これは日本語の改行規則を示す文章です。</p>

Korean Text

<p lang="ko">이 문장은 한국어 줄 바꿈 규칙을 보여 줍니다.</p>

Language-Specific Styling

:lang(ja) {
  line-break: strict;
}
:lang(zh) {
  line-break: normal;
}
:lang(ko) {
  line-break: normal;
}

Important Consideration

Line-breaking behavior should be chosen according to the content language and typography requirements. Avoid assuming that a single setting is ideal for every East Asian writing system.

Punctuation and Line Breaking

East Asian typography often restricts where punctuation marks may appear relative to line boundaries.

Closing Punctuation

Closing punctuation marks, such as Japanese 。 and 、, generally should not appear at the beginning of a line.

Opening Punctuation

Opening punctuation marks generally should not appear at the end of a line.

Small Characters

Some small Japanese characters have additional restrictions under strict line-breaking rules.

Strict Punctuation Handling

.japanese-text {
  line-break: strict;
}

Loose Punctuation Handling

.japanese-text {
  line-break: loose;
}

Important Consideration

The browser determines actual break opportunities according to the applicable Unicode and CSS text rules. The line-break property adjusts those rules rather than manually positioning punctuation.

Language Attributes

The HTML lang attribute identifies the language of text and helps browsers apply appropriate language-sensitive behavior.

Japanese Language

<p lang="ja">日本語の文章です。</p>

Simplified Chinese

<p lang="zh-Hans">这是简体中文文本。</p>

Traditional Chinese

<p lang="zh-Hant">這是繁體中文文字。</p>

Korean Language

<p lang="ko">한국어 문장입니다.</p>

Language-Specific CSS

:lang(ja) {
  line-break: strict;
}
:lang(zh) {
  line-break: normal;
}

Important Consideration

Always identify the correct language in HTML. The line-break property does not replace language metadata, and language information can influence text shaping, font selection, and line-breaking behavior.

line-break vs. word-break

The line-break and word-break properties both influence text wrapping, but they serve different purposes.

Property Purpose
line-break Controls the strictness of language-specific line-breaking restrictions.
word-break Controls how line breaks are allowed within or around words and character sequences.

Strict Line Breaking

.text {
  line-break: strict;
}

Word Breaking

.text {
  word-break: break-all;
}

Combining Properties

.text {
  line-break: strict;
  word-break: normal;
}

Important Consideration

Use line-break for East Asian punctuation and line-breaking conventions. Use word-break when controlling whether words or character sequences may break internally.

line-break vs. overflow-wrap

The overflow-wrap property provides additional break opportunities when text would otherwise overflow its container.

Property Purpose
line-break Controls language-sensitive line-breaking restrictions.
overflow-wrap Allows otherwise unbreakable text to wrap to prevent overflow.

Language-Specific Breaking

.text {
  line-break: strict;
}

Overflow Protection

.text {
  overflow-wrap: anywhere;
}

Combining Properties

.text {
  line-break: normal;
  overflow-wrap: anywhere;
}

Important Consideration

Use overflow-wrap to address long URLs, identifiers, and other text that might overflow. Use line-break to control language-specific break restrictions.

line-break and white-space

The white-space property controls whitespace handling and whether text is allowed to wrap.

Normal Wrapping

.text {
  white-space: normal;
  line-break: strict;
}

Prevent Wrapping

.text {
  white-space: nowrap;
  line-break: strict;
}

When wrapping is disabled, the line-break setting does not create ordinary automatic line breaks.

Preserve Whitespace and Wrap

.text {
  white-space: pre-wrap;
  line-break: normal;
}

Important Consideration

The line-break property determines permitted break opportunities, while white-space determines whether normal wrapping is enabled.

Writing Modes

The line-break property works with horizontal and vertical writing modes.

Horizontal Text

.horizontal-text {
  writing-mode: horizontal-tb;
  line-break: strict;
}

Vertical Text

.vertical-text {
  writing-mode: vertical-rl;
  line-break: strict;
}

Vertical Japanese Text

<p lang="ja" class="vertical-japanese">縦書きの日本語文章です。</p>
.vertical-japanese {
  writing-mode: vertical-rl;
  line-break: strict;
}

Important Consideration

Line-breaking rules operate along the inline text direction. In vertical writing, line progression and available inline space differ from horizontal layouts.

Responsive Layouts

Responsive layouts can use different line-breaking rules when text containers become narrow.

Desktop Typography

.article-text {
  line-break: strict;
}

Narrow Screens

@media (max-width: 600px) {
  .article-text {
    line-break: loose;
  }
}

Compact Cards

.card-text {
  line-break: loose;
  overflow-wrap: anywhere;
}

Important Consideration

Changing to loose may improve wrapping in narrow CJK text containers, but it is not a universal solution for overflow. Test the actual text and languages used.

Inheritance

The line-break property is inherited. Descendant elements normally use the parent's computed value unless they specify another value.

Parent Setting

.article {
  line-break: strict;
}

Child Override

.article {
  line-break: strict;
}
.article .compact-text {
  line-break: loose;
}

Explicit Inheritance

.child {
  line-break: inherit;
}

Reset to Initial Value

.child {
  line-break: initial;
}

This resets the property to auto.

Using unset

.child {
  line-break: unset;
}

Because the property is inherited, unset behaves like inherit.

Important Consideration

Inheritance is useful for applying consistent typography to an article or language-specific section. Individual elements can override the inherited setting when necessary.

line-break Example

This example compares loose, normal, strict, and anywhere using Japanese text in narrow containers.

HTML Example

<div class="line-break-demo">
  <div class="demo-item">
    <h3>loose</h3>
    <p lang="ja" class="demo-text loose">これは日本語の文章です。句読点や小さな文字の改行位置を確認します。</p>
  </div>
  <div class="demo-item">
    <h3>normal</h3>
    <p lang="ja" class="demo-text normal">これは日本語の文章です。句読点や小さな文字の改行位置を確認します。</p>
  </div>
  <div class="demo-item">
    <h3>strict</h3>
    <p lang="ja" class="demo-text strict">これは日本語の文章です。句読点や小さな文字の改行位置を確認します。</p>
  </div>
  <div class="demo-item">
    <h3>anywhere</h3>
    <p lang="ja" class="demo-text anywhere">これは日本語の文章です。句読点や小さな文字の改行位置を確認します。</p>
  </div>
</div>

CSS Example

.line-break-demo {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}
.line-break-demo .demo-item {
  width: 160px;
}
.line-break-demo h3 {
  margin: 0 0 8px;
  font-size: 0.875rem;
}
.line-break-demo .demo-text {
  margin: 0;
  padding: 10px;
  min-height: 160px;
  border: 1px solid #cbd5e1;
  background-color: #f1f5f9;
  font-size: 1rem;
  line-height: 1.6;
}
.line-break-demo .loose {
  line-break: loose;
}
.line-break-demo .normal {
  line-break: normal;
}
.line-break-demo .strict {
  line-break: strict;
}
.line-break-demo .anywhere {
  line-break: anywhere;
}
Browser Result

loose

これは日本語の文章です。句読点や小さな文字の改行位置を確認します。

normal

これは日本語の文章です。句読点や小さな文字の改行位置を確認します。

strict

これは日本語の文章です。句読点や小さな文字の改行位置を確認します。

anywhere

これは日本語の文章です。句読点や小さな文字の改行位置を確認します。

Depending on the browser and available font, some values may produce similar results. The differences become more noticeable when punctuation or small characters fall near a line boundary.

Try a Narrower Width

.line-break-demo .demo-item {
  width: 120px;
}

Narrower containers create more line breaks and can make differences between the values easier to observe.

Try Strict Breaking

.line-break-demo .demo-text {
  line-break: strict;
}

All examples now use strict line-breaking rules unless a more specific selector overrides the declaration.

Common Mistakes

Confusing line-break with line-height

The line-break property controls permitted line-break positions. The line-height property controls the height of line boxes.

Using Invalid Values

.text {
  line-break: 2px;
}

This is invalid because line-break accepts keywords, not length values.

Expecting Visible Differences in English Text

The property primarily affects East Asian line-breaking conventions. Ordinary English paragraphs may look identical under several values.

Forgetting Language Information

Without appropriate language metadata, browsers may not apply the intended language-sensitive behavior.

Assuming strict Prevents All Wrapping

The strict value restricts certain break opportunities but does not disable line wrapping.

Confusing anywhere with overflow-wrap

line-break: anywhere and overflow-wrap: anywhere are different properties with different line-breaking rules.

Using line-break to Fix Every Overflow Problem

Long URLs and unbroken identifiers may require overflow-wrap or another wrapping strategy.

Ignoring white-space

When white-space: nowrap prevents automatic wrapping, changing line-break generally will not produce additional ordinary line breaks.

Assuming Every Browser Produces Identical Breaks

Actual line wrapping can vary with browser implementation, language, font metrics, and available width.

Important Considerations

Keep the following points in mind when using line-break:

  • The property controls the strictness of line-breaking rules.
  • It is particularly relevant to Chinese, Japanese, and Korean text.
  • The initial value is auto.
  • The property is inherited.
  • auto allows the browser to select an appropriate rule set.
  • loose permits additional break opportunities under relaxed rules.
  • normal uses standard line-breaking restrictions.
  • strict applies stricter restrictions around certain punctuation and characters.
  • anywhere allows additional breaks around typographic character boundaries.
  • The property does not accept lengths or percentages.
  • It does not directly control line height or spacing between lines.
  • It determines permitted break opportunities rather than forcing specific breaks.
  • The actual line breaks depend on available inline space.
  • Font metrics and text shaping can affect the resulting layout.
  • Language metadata can influence line-breaking behavior.
  • Use the HTML lang attribute to identify the content language.
  • Japanese punctuation and small characters can have special break restrictions.
  • Chinese and Korean typography can use different line-breaking conventions.
  • The property works with horizontal and vertical writing modes.
  • word-break controls a different aspect of word and character breaking.
  • overflow-wrap can help prevent overflow from unbreakable text.
  • white-space controls whether ordinary wrapping is allowed.
  • Responsive layouts may benefit from different line-breaking settings.
  • The property uses discrete animation behavior.
  • Browser implementations may produce different results for some character sequences.
  • Test with real content in the intended languages and fonts.

Browser Support

The CSS line-break property is widely supported in modern browsers, including Chrome, Edge, Firefox, Safari, and Opera.

Support and behavior can vary for individual values, especially anywhere, and for language-specific punctuation rules. Some browsers may produce different line-break opportunities for the same text.

For current compatibility information, visit Can I Use? and search for line-break.

Specifications

The line-break property is defined in the CSS Text Module Level 3 specification.

CSS Text Module Level 3: line-break

The specification defines the available values and their effects on language-sensitive line-breaking rules.

For additional documentation and examples, consult MDN Web Docs.

MDN Web Docs: line-break