- Services
- Case Studies
- Technologies
- NextJs development
- Flutter development
- NodeJs development
- ReactJs development
- About
- Contact
- Tools
- Blogs
- FAQ
Understanding CSS Break-After for Better Layouts
Discover available options and how to use them effectively.
Column Break Values
The break-after
property in CSS includes specific values to manage column breaks, which are crucial for controlling the layout of content in multi-column designs.
avoid-column
- Description: Prevents a column break right after the principal box. This ensures that the content is not split across columns, maintaining continuity.
- Usage: Useful for keeping related content together, such as a heading and its corresponding paragraph, within the same column.
column
- Description: Forces a column break right after the principal box. This ensures that new content starts in a new column, useful for section breaks or starting new sections within a multi-column layout.
- Usage: Ideal for starting new sections or content within a new column, improving readability and organization.
Region Break Values
The break-after
property in CSS also includes specific values for managing region breaks, which are essential for controlling the layout of content within defined regions.
avoid-region
- Description: Prevents a region break right after the principal box. This ensures that the content is not split across regions, maintaining continuity.
- Usage: Useful for keeping related content together within the same region.
region
- Description: Forces a region break right after the principal box. This ensures that new content starts in a new region, useful for section breaks or starting new sections within a region-based layout.
- Usage: Ideal for starting new sections or content within a new region, improving readability and organization.
Page Break Aliases
For compatibility reasons, the legacy page-break-after
property should be treated as an alias of break-after
. A subset of values should be aliased as follows:
page-break-after | break-after |
---|---|
auto | auto |
left | left |
right | right |
avoid | avoid |
always | page |
Formal Definition
The break-after
property in CSS is formally defined as follows:
- Initial Value:
auto
- Applies To: Block-level elements
- Inherited: No
- Computed Value: As specified
- Animation Type: Discrete
Formal Syntax
The syntax for the break-after
property is:
Examples
Breaking into Neat Columns
In this example, we use break-after: column
to force a column break after each paragraph, ensuring each <h2>
appears neatly at the top of each column.
HTML
CSS
Forcing Page Breaks
In this example, we use break-after: page
to force a page break after specific elements, ensuring new content starts on a new page.
HTML
CSS
Controlling Column Breaks
In this example, we use break-after: column
to control column breaks in a multi-column layout.
HTML
CSS
Browser Compatibility
The break-after
property is widely supported across modern web browsers:
- Google Chrome: Full support for all values.
- Mozilla Firefox: Partial support for some values.
- Safari: Partial support for some values.
- Microsoft Edge: Full support for all values.
- Opera: Full support for all values.
- Internet Explorer: Limited support for some values.
For older browsers, use the page-break-after
property as an alias for the break-after
property to ensure backward compatibility.
Page-Break-After vs Break-After
page-break-after | break-after |
---|---|
auto | auto |
left | left |
right | right |
avoid | avoid |
always | page |
Note: The always
value in page-break-*
was implemented by browsers as a page break, not a column break. So, it’s mapped to page
instead of always
in the newer spec.
See Also
To learn more about the break-after
property, check out these resources:
- Multiple-column Layout: Learn how to create multi-column layouts and use
break-after
effectively. ( WebsiteUrl ) - Breaking Boxes With CSS Fragmentation: A guide on CSS fragmentation and using
break-after
in different contexts. ( WebsiteUrl ) - CSS Fragmentation Module Level 3: The official spec for the CSS Fragmentation Module, which defines
break-after
. ( WebsiteUrl ) - CSS Regions Module Level 1: The official spec for the CSS Regions Module, which introduces CSS regions and defines
break-after
for managing breaks within region flows. ( WebsiteUrl ) - CSS Multi-column Layout Module Level 1: The official spec for the CSS Multi-column Layout Module, detailing how to lay out content in multiple columns and use
break-after
to manage column breaks. ( WebsiteUrl )
Talk with CEO
We'll be right here with you every step of the way.
We'll be here, prepared to commence this promising collaboration.
Whether you're curious about features, warranties, or shopping policies, we provide comprehensive answers to assist you.