🧩 CSS break-after, break-before, break-inside — Complete Tutorial

🌐 What Are CSS Break Properties?

The properties break-after,break-before, andbreak-inside control how content breaks in:

  • 📄 Multi-column layouts
  • 📑 Printed pages (@media print)
  • 📦 Paged media (ebooks, PDFs, reports)
  • 📐 Regions (deprecated but still relevant historically)
>>“Break properties let you control exactly where content should start, stop, or avoid breaking across pages or columns.”

📦 Syntax

break properties

break-after: auto | avoid | always | page | column | left | right;
break-before: auto | avoid | always | page | column | left | right;
break-inside: auto | avoid | avoid-page | avoid-column;

📌 Values Explained

ValueMeaning
autoDefault. Allows breaks when needed.
avoidAvoids breaking at this element (applies to before/after/inside).
alwaysForces a break before/after the element.
pageForce a page break (print).
columnForce a column break (multi-column layout).
leftStart a new left page (print books).
rightStart a new right page (print books).
avoid-pageAvoid page breaks inside an element.
avoid-columnAvoid column breaks inside an element.

📘 1. break-after

Controls whether a break happens immediately after the selected element.

✔ Force a Column Break After an Element

break-after: column

h2 {
  break-after: column;
}

After each <h2>, content jumps to the next column.

✔ Create a Page Break After a Section (Print)

break-after: page

section.chapter {
  break-after: page;
}

Useful for PDFs, ebooks, reports.

📘 2. break-before

Controls whether a break occurs before the element.

✔ Start New Column Before Element

break-before: column

.important {
  break-before: column;
}

✔ Force New Page Before Chapter Heading

break-before: page

.chapter-title {
  break-before: page;
}

Ensures each chapter starts on a new page in printed formats.

📘 3. break-inside

Prevents content from breaking inside an element. Crucial for headings, images, cards, or boxes in columns.

✔ Prevent Images or Cards From Splitting

break-inside: avoid

img, .card, h2 {
  break-inside: avoid;
}

Ensures these elements stay whole inside a column or printed page.

✔ Avoid Column Breaks Inside a Block

avoid inside

.quote {
  break-inside: avoid-column;
}

🧪 Real-World Examples

1️⃣ Multi-Column Article With Clean Section Breaks

Article layout

article {
  column-count: 3;
}

h2 {
  break-before: column;
}

p, img {
  break-inside: avoid;
}

Ensures each section begins at the top of a column and prevents awkward splits.

2️⃣ Prevent Breaking Cards in a Masonry Layout

Masonry grid

.grid {
  column-count: 4;
  column-gap: 1rem;
}

.card {
  break-inside: avoid;
  margin-bottom: 1rem;
}

Keeps each card intact — essential for Pinterest-style layouts.

3️⃣ Print Layout: Chapters Start on New Pages

Print chapters

@media print {
  h1 {
    break-before: page;
  }
  
  .section {
    break-inside: avoid-page;
  }
}

4️⃣ Force Page Break After A Table When Printing

Print table break

table {
  break-after: page;
}

⚠️ Common Mistakes

  • ❌ Thinking breaks affect Flexbox or Grid (they do not)
  • ❌ Not combining breaks with multi-column or print contexts
  • ❌ Overusing forced breaks → uneven layouts
  • ❌ Using avoid on large elements → layout may fail to break at all

Note

Break properties shine in multi-column layouts and printed documents.

🔥 Summary

The CSS break properties give fine control over how content flows across pages, columns, or other fragmented contexts. Use break-before and break-after to force breaks, and break-inside to prevent awkward splitting.

>>“Mastering break properties is essential for professional pagination, printing, and multi-column layouts.”

Learn more →MDN: CSS Fragmentation 📘

🔽 CSS break-after — Complete Tutorial

🌐 What Is break-after?

The break-after property controls whether apage break, column break, or region break should occurimmediately after an element. It is part of the CSS Fragmentation Module and is used in:

  • 📄 Multi-column layouts
  • 📑 Printed pages (@media print)
  • 📘 Paged media (ebooks, PDFs)
>>“Use break-after when you want the next piece of content to begin in a new column or on a new page.”

Note

✔ Great for structuring multi-column articles
✔ Crucial for print layouts (manual page breaks)
✔ Works with page, column, and region fragmentation

📦 Syntax

break-after syntax

break-after: 
  auto | avoid | always | page | column | left | right | recto | verso;
ValueMeaning
autoDefault. Browser decides where to break.
avoidTry to prevent a break after the element.
alwaysAlways force a break after the element.
pageForce a page break (print).
columnForce a column break (multi-column layouts).
leftNext page must be a left page (print books).
rightNext page must be a right page (print books).
rectoAlias for right page.
versoAlias for left page.

📌 1. Force a Column Break After an Element

break-after: column

h2 {
  break-after: column;
}

After each <h2>, the next content begins in a new column. Useful for multi-column articles or magazines.

📌 2. Force a Page Break After an Element (Print Layout)

Page break

@media print {
  .chapter-end {
    break-after: page;
  }
}

Ensures each chapter ends with a page break when printing.

📌 3. Force a Break After Every Section

Section break

section {
  break-after: always;
}

Forces fragmentation after every section.

📌 4. Avoid a Break After an Element

Avoid break

.no-break {
  break-after: avoid;
}

Prevents unwanted breaks in columns or pages — useful for images, titles, etc.

📌 5. Using break-after With Multi-Column Layout

Multi-column layout

article {
  column-count: 3;
}

h2 {
  break-after: column;
}

p, img {
  break-inside: avoid;
}

Ensures each section starts at the top of a new column and prevents awkward splitting of paragraphs or images.

📌 6. Start New Left/Right Pages (Book Layouts)

Book formatting

@media print {
  h1 {
    break-after: right; /* Next page is a right-hand page */
  }
}

Used for professional publishing workflows.

🧪 Real-World Examples

1️⃣ Pagination for PDF Reports

Print report

@media print {
  .page-break {
    break-after: page;
  }
}

2️⃣ Avoid Split Cards in a Multi-Column Layout

Card split prevention

.card {
  break-after: avoid;
  break-inside: avoid;
}

3️⃣ Create Magazine-Style Column Sections

Magazine design

h2 {
  break-after: column;
}

.subheading {
  break-after: avoid;
}

⚠️ Common Mistakes

  • ❌ Expecting breaks to work in Flexbox or Grid (they don’t)
  • ❌ Using break-after without a multi-column or print context → no visible effect
  • ❌ Forcing too many breaks → messy layout
  • ❌ Using avoid on large blocks → layout might stretch awkwardly

Note

Break properties work only in **fragmented contexts**, not in regular block flow.

🔥 Summary

break-after gives fine control over where new columns or pages begin. It is essential for professional multi-column layouts, printing workflows, and paginated content like reports, ebooks, or documentation.

>>“Master break-after to create clean, readable, and professionally structured documents.”

Learn more →MDN Docs 📘

🔼 CSS break-before — Complete Tutorial

🌐 What Is break-before?

The break-before property controls whether apage break, column break, or region break should occurimmediately before an element. It is part of the CSS Fragmentation Module and is used in:

  • 📄 Multi-column layouts
  • 📑 Page-based layouts (@media print)
  • 📘 Paged media (ebooks, reports, PDFs)
>>“Use break-before when you want a new section to start at the top of a column or on a new page.”

Note

✔ Works in multi-column layouts and printed documents
✔ Forces or avoids breaks before the element
✔ Similar to break-after, but triggers the break earlier

📦 Syntax

break-before syntax

break-before:
  auto | avoid | always | page | column | left | right | recto | verso;
ValueDescription
autoDefault. Browser decides when to break.
avoidAvoids breaking before the element.
alwaysAlways break before the element.
pageForce a page break before element.
columnForce a column break before element.
leftNext page must be a left-hand page (print books).
rightNext page must be a right-hand page.
rectoAlias of right.
versoAlias of left.

📌 1. Force a Column Break Before a Heading

break-before: column

h2 {
  break-before: column;
}

Ensures each <h2> starts at the top of a new column — great for multi-column articles or magazines.

📌 2. Force a Page Break Before a Chapter (Print)

Print page break

@media print {
  .chapter-title {
    break-before: page;
  }
}

Ensures every chapter begins on a fresh printed page.

📌 3. Start New Page Only on Right (Recto) Pages

Recto page

@media print {
  h1 {
    break-before: right; /* or recto */
  }
}

Used in book publishing to ensure titles always appear on right-hand pages.

📌 4. Avoid Breaks Before Elements

No break

.no-break-before {
  break-before: avoid;
}

Prevents undesirable breaks before elements like subtitles or images.

📌 5. Use in Multi-Column Layouts (Web + Print)

Columns + break-before

article {
  column-count: 3;
  column-gap: 40px;
}

h2 {
  break-before: column;
}

p, img {
  break-inside: avoid;
}

Ensures major sections begin at the top of a column and content stays intact.

📌 6. Flow Content Across Pages in Reports

Report layout

@media print {
  table {
    break-before: page;
  }
}

Large elements like tables often benefit from starting on a new page.

🧪 Real-World Examples

1️⃣ PDF / Book Chapter Formatting

Chapter formatting

@media print {
  .chapter {
    break-before: page;
  }
}

2️⃣ Multi-Column Resume Layout

Resume example

.section-title {
  break-before: column;
}

3️⃣ Avoid Breaking Before Cards in a Masonry Grid

Card grid

.card {
  break-before: avoid;
  break-inside: avoid;
}

⚠️ Common Mistakes

  • ❌ Expecting breaks to affect Flexbox/Grid (they do not)
  • ❌ Using break-before without multi-column or print context → no effect
  • ❌ Overusing forced breaks → awkward spacing
  • ❌ Using avoid on large blocks → layout can stretch unpredictably

Note

Break-before works only in fragmented contexts— multi-column, paged media, and print layouts.

🔥 Summary

The break-before property gives fine control over where new pages or columns begin. It is invaluable for professional printing, ebook formatting, multi-column layouts, and long-form content.

>>“Use break-before to create clean, structured, publication-quality layouts.”

Learn more →MDN Docs 📘

🧱 CSS break-inside — Complete Tutorial

🌐 What Is break-inside?

The break-inside property controls whether content is allowed to break inside an element when the layout is fragmented. Fragmentation occurs in:

  • 📄 Multi-column layouts
  • 📑 Printed pages (@media print)
  • 📦 Paged media (PDFs, ebooks, reports)
>>“Use break-inside to prevent images, cards, tables, or headings from splitting across columns or pages.”

Note

✔ Prevents awkward column or page splits
✔ Essential for masonry layouts and multi-column text
✔ Works only in fragmented contexts (not Grid/Flexbox)

📦 Syntax

break-inside syntax

break-inside: auto | avoid | avoid-page | avoid-column;
ValueDescription
autoDefault. Allows breaks inside the element.
avoidAvoids any break inside the element.
avoid-pagePrevents page breaks inside (print).
avoid-columnPrevents column breaks inside.

📌 1. Prevent Breaking Inside Cards (Masonry Layout)

Cards stay whole

.card {
  break-inside: avoid;
}

Ensures cards do not split across columns — essential in masonry-style layouts.

📌 2. Prevent Breaking Inside Images

No split images

img {
  break-inside: avoid;
}

Prevents images from splitting across printed pages or columns.

📌 3. Prevent Headings From Breaking

Heading protection

h2, h3 {
  break-inside: avoid;
}

Ensures headings stay grouped with their content.

📌 4. Prevent Splits Inside Tables (Print)

Tables stay together

@media print {
  table {
    break-inside: avoid-page;
  }
}

Essential when printing financial reports or documents with tabular data.

📌 5. Avoid Column Breaks Inside Quotes or Special Sections

Avoid breaking inside block

blockquote {
  break-inside: avoid-column;
}

Helps maintain readability and flow across columns.

📌 6. Use With Multi-Column Layout

Multi-column example

article {
  column-count: 3;
}

p, img, h2 {
  break-inside: avoid;
}

Prevents awkward splits while reading multi-column text.

🧪 Real-World Examples

1️⃣ Pinterest-Style Masonry Layout

Masonry grid using columns

.grid {
  column-count: 4;
  column-gap: 1.5rem;
}

.card {
  margin-bottom: 1.5rem;
  break-inside: avoid;
}

The browser arranges cards beautifully without splitting them.

2️⃣ Newsletter or Magazine Columns

Newsletter

.newsletter {
  column-count: 2;
}

blockquote,
figure {
  break-inside: avoid-column;
}

Prevents quotes or images from getting split across columns.

3️⃣ Printing Reports Without Page Breaks in Sections

Print report

@media print {
  .report-section {
    break-inside: avoid-page;
  }
}

Keeps each report section intact across printed pages.

⚠️ Common Mistakes

  • ❌ Expecting break-inside to work on Flexbox or Grid layouts
  • ❌ Using avoid on very large elements → browser may still break if needed
  • ❌ Forgetting that fragmentation context is required (columns or print)

Note

break-inside is one of the most powerful tools for controlling fragmentation, but it only works in the correct context.

🔥 Summary

The break-inside property prevents unwanted splits inside content blocks when working with multi-column layouts orprinted/paged documents. Use it for images, cards, tables, quotes, and sections to maintain readability.

>>“Good typography means keeping content together — break-inside helps you do exactly that.”

Learn more → MDN Docs 📘