

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Usage of page-break-before, page-break-after, and page-break-inside properties in CSS
Suppose your document has level-1 headers start new chapters with level-2 headers to denote sections. You'd like each chapter to start on a new, right-hand page, but you don't want section headers to be split across a page break from the subsequent content. You can achieve this using following rule −
<style> <!-- h1 { page-break-before : right } h2 { page-break-after : avoid } --> </style>
Use only the auto and avoid values with the page-break-inside property. If you prefer that your tables not be broken across pages if possible, you would write the rule −
<style> <!-- table { page-break-inside : avoid } --> </style>
- Related Questions & Answers
- Adding a Page break/new page in SAP Script
- How to set the page-break behavior before an element with JavaScript?
- How to set the page-break behavior inside an element with JavaScript?
- How to set the page-break behavior after an element with JavaScript?
- CSS word-break property
- CSS @page rule
- How to set the minimum number of lines for an element that must be left at the bottom of a page when a page break occurs inside an element with JavaScript?
- Word Break Problem
- PHP break Statement
- Difference Between break and continue
- Word Break in Python
- Integer Break in C++
- Add line break inside a string conditionally in JavaScript
- Break Statement in C/C++
- Break a Palindrome in C++
Advertisements