πŸ”€ CSS line-break β€” Complete Tutorial

🌐 What Is line-break?

The line-break property controls how text wraps in languages that use **East Asian scripts** (Chinese, Japanese, Korean β€” CJK). It defines how strictly the browser should follow line-breaking rules and how it handles punctuation, symbols, and special characters.

>>β€œUse line-break to control how aggressively the browser wraps CJK text or handles tight punctuation rules.”

Note

βœ” Affects wrapping behavior
βœ” Important for CJK typography
βœ” Has no visible effect on English-only text

πŸ“¦ Syntax

line-break syntax

line-break: auto | loose | normal | strict | anywhere;
ValueMeaning
autoBrowser decides based on language rules (default).
looseAllows more break opportunities (more wrapping).
normalStandard line-breaking rules.
strictVery strict CJK line-breaking (fewer line breaks).
anywhereBreak text at any point if needed β€” even inside long words or before punctuation.

πŸ“Œ 1. Default Behavior (auto)

auto

p {
  line-break: auto;
}

Browser follows typical line-breaking rules for the language detected.

πŸ“Œ 2. Allow Looser Line Breaks

loose

p {
  line-break: loose;
}

Adds more break opportunities β€” useful when dealing with narrow columns of CJK text.

πŸ“Œ 3. Use Standard Line Break Rules

normal

p {
  line-break: normal;
}

A balanced option between strict and loose rules.

πŸ“Œ 4. Apply Strict Japanese/Chinese Line Breaking

strict

p {
  line-break: strict;
}

Prevents breaks before characters like:!”, ? . ] ) } 、 。Improves professional typesetting in Japanese/Chinese documents.

πŸ“Œ 5. Break Text Anywhere (Even Inside Words)

anywhere

p {
  line-break: anywhere;
}

Break text even when rules normally forbid it. Useful for long URLs, file paths, or technical strings that overflow.

πŸ§ͺ Real-World Use Cases

1️⃣ Japanese Newspaper Layout

Japanese layout

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

Ensures correct and readable Japanese line-breaking.

2️⃣ CJK Text in Very Narrow Mobile Layouts

Responsive CJK text

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

3️⃣ Prevent Overflow of Code Snippets or URLs

break anywhere

.url {
  line-break: anywhere;
  word-break: break-all;
}

Prevents long URLs or strings from causing horizontal scroll.

πŸ“š Related Properties

  • word-break β€” controls breaking inside words
  • white-space β€” preserves or collapses spaces
  • overflow-wrap β€” allows breakpoints to prevent overflow

⚠️ Common Mistakes

  • ❌ Expecting line-break to affect Latin (English) text
  • ❌ Using anywhere without considering readability
  • ❌ Confusing line-break with word-break

Note

line-break is especially meaningful in East Asian typography; for English layouts, use word-break or overflow-wrap.

πŸ”₯ Summary

The line-break property gives deep control over line-wrapping behavior, specifically for CJK languages. Use strict rules for professional typesetting and looser or anywhere rules for responsive, compact, or constrained layouts.

>>β€œGood typography is not just about letters β€” it’s about where they break.”

Learn more β†’MDN Docs πŸ“˜