CSS ngắt trang trước Thuộc tính
Thí dụ
Luôn chèn dấu ngắt trang trước phần tử <h1>:
@media print
{
h1 {page-break-before: always;}
}
Định nghĩa và Cách sử dụng
Thuộc page-break-before
tính thêm dấu ngắt trang trước 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: | object .style.pageBreakBefore = "always" |
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-before | 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-before: auto|always|avoid|left|right|initial|inherit;
Giá trị tài sản
Value | Description |
---|---|
auto | Default. Automatic page-breaks |
always | Always insert a page-break before the element |
avoid | Avoid page-break before the element (if possible) |
left | Insert page-break before the element so that the next page is formatted as a left page |
right | Insert page-break before 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 DOM HTML: thuộc tính pageBreakBefore