Kombai Logo

Tailwind CSS Break After

Break After controls how a document or container breaks after a specific element (for instance, a page break in printed documents or a column break in multicol layouts). Tailwind’s utility classes simplify the process of applying these break rules, offering concise and consistent syntaxes that can integrate seamlessly with responsive design or state-based interactions.

This guide delves into using these utilities, explaining how to use them in various contexts to achieve precise control over content flow.

ClassPropertiesExample
break-after-autobreak-after: auto;<div className="break-after-auto"></div>
break-after-avoidbreak-after: avoid;<div className="break-after-avoid"></div>
break-after-allbreak-after: all;<div className="break-after-all"></div>
break-after-avoid-pagebreak-after: avoid-page;<div className="break-after-avoid-page"></div>
break-after-pagebreak-after: page;<div className="break-after-page"></div>
break-after-leftbreak-after: left;<div className="break-after-left"></div>
break-after-rightbreak-after: right;<div className="break-after-right"></div>
break-after-columnbreak-after: column;<div className="break-after-column"></div>

Overview of Break After

Adding the Break After

To insert a break point immediately after an element, such as a paragraph, heading, or a specific container— use the break-after-* utilities.

In this snippet, the break-after-page class (which corresponds to standard CSS break-after: page;) ensures that when this layout is printed, the second container will force the next segment onto a new page or column.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

States and Responsiveness

While applying break-after classes is helpful in a static context, modern web development often requires handling dynamic states (like hover or focus) and varying screen sizes. Tailwind CSS provides state and responsive variants to handle these scenarios.

Hover and Focus States

Even though break-after is often considered in the context of printed or multi-column layouts, you can occasionally use it for interactive states. For example, you might want to force a column break after an element only when a user interacts with it (e.g., on hover or focus) in a multi-column layout.

In Tailwind CSS, you can achieve this by prepending state modifiers to the utility class. Ensure your element is part of a multi-column layout for break-after to have an effect.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

With the hover:break-after-column, the browser attempts to push the next block into the next column in a multi-column context whenever the mouse hovers over the container. Although this is a niche scenario, it showcases how you can creatively combine Tailwind’s state variants with break-after to adapt layout structures.

Breakpoint Modifiers

Screen size can significantly impact decisions about content breaks. On mobile screens, you typically want content to flow seamlessly without abrupt pagination or column transitions, but on larger screens, breaks can enhance clarity.

Tailwind provides breakpoint variants to apply break-after utilities conditionally, ensuring a more fluid, device-adaptive layout.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

Real World Examples

Product Category Cards

This example shows product category cards where each columns breaks after 3 items for optimal layout.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

Blog Post Content

This example demonstrates a blog post layout with page breaks after each major content block.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

Team Member Directory with Column Breaks

This example shows a team directory with column breaks.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

This example shows an invoice layout with strategic page breaks for printing.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

Product Catalog

This example shows a product catalog that avoids any breaks by using the break-after-avoid property.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

Best Practices

Maintain Design Consistency

Maintaining design consistency is crucial when applying the break-after utility in Tailwind CSS. This utility controls the behavior of block-level elements after a specified element, ensuring that content flows predictably across different layouts. To maintain uniformity, establish guidelines for using break-after-column, break-after-avoid, break-after-page, etc. in similar contexts, such as sections, articles, or print layouts.

For example, consistently applying break-after-page for printable sections ensures a standardized and professional look across all pages. Additionally, document these conventions within your design system or style guide so developers can apply them consistently across projects. Ensure that your designs are predictable and align with user expectations for page and section breaks.

Build Responsive Design

Responsive variants are crucial when building modern user interfaces. Tailwind allows you to prefix responsive modifiers with break-after classes- md:break-after-column, or lg:break-after-page to conditionally apply breaks at certain device widths. This ensures small screen users view content in a more streamlined manner, whereas larger screens may showcase multi-column flows or enforced page breaks for print.

When refining layouts for responsiveness, plan systematically. Start by considering how elements display on the smallest screen size, usually letting them flow naturally. As you move upwards in breakpoints, introduce break-after-column, break-after-page, or other classes to handle wider device contexts or print layouts. This approach respects progressive enhancement principles and helps avoid abrupt changes in user experience.

Accessibility Considerations

Enhance Readability and Navigability

The break-after utility in Tailwind CSS can improve layout structure and content organization, particularly in contexts where logical content divisions are essential, such as print layouts or multi-column designs. By strategically applying break-after, you can create clear and consistent visual divisions that enhance the user experience.

For example, in long-form documents or articles, using break-after-page in print layouts ensures that each section starts on a new page. This helps provide a clear organizational structure for printed content. Similarly, for on-screen navigation, break-after-column can be applied in multi-column layouts to divide content into manageable chunks, preventing visual overwhelm for users.

Ensure Keyboard Accessibility

Keyboard users rely on predictable navigation and logical content flow. Misusing break-after can disrupt this flow, especially when it causes elements to visually shift or creates unexpected jumps for users tabbing through the page.

For example, starting a new column in the middle of a component might confuse users if the focus suddenly moves to another section. To maintain keyboard accessibility, plan how elements appear both visually and in code order. Thoughtful use of break-after ensures a great experience for all users.