Thuộc tính ngắt trang CSS
Thí dụ
Luôn chèn ngắt trang sau phần tử <footer>:
@media print
{
footer {page-break-after: always;}
}
Định nghĩa và Cách sử dụng
Thuộc page-break-after
tính thêm dấu ngắt trang sau phần tử được chỉ định.
Mẹo: Các thuộc tính: page-break-before , page-break-after và page-break-inside giúp xác định cách tài liệu sẽ hoạt động khi được in.
Lưu ý: Bạn không thể sử dụng thuộc tính này trên một <div> trống hoặc trên các phần tử được định vị tuyệt đối.
Giá trị mặc định: | Tự động |
---|---|
Thừa hưởng: | không |
Hoạt hình: | không. Đọc về hoạt hình |
Phiên bản: | CSS2 |
Cú pháp JavaScript: | đối tượng .style.pageBreakAfter = "luôn luôn" |
Hỗ trợ trình duyệt
Các số trong bảng chỉ định phiên bản trình duyệt đầu tiên hỗ trợ đầy đủ thuộc tính.
Property | |||||
---|---|---|---|---|---|
page-break-after | 1.0 | 4.0 | 1.0 | 1.2 | 7.0 |
Lưu ý: Không có trình duyệt nào hỗ trợ "tránh".
Lưu ý: Trình duyệt có thể hiểu "trái" và "phải" là "luôn luôn".
Cú pháp CSS
page-break-after: auto|always|avoid|left|right|initial|inherit;
Giá trị tài sản
Value | Description |
---|---|
auto | Default. Automatic page-break |
always | Always insert a page-break after the element |
avoid | Avoid a page-break after the element (if possible) |
left | Insert page-break after the element so that the next page is formatted as a left page |
right | Insert page-break after the element so that the next page is formatted as a right page |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Các trang liên quan
Tham chiếu HTML DOM: thuộc tính pageBreakAfter