Trang phong cáchBreakBefore Thuộc tính
Thí dụ
Luôn đặt ngắt trang trước mỗi phần tử <p> có id = "footer":
document.getElementById("footer").style.pageBreakBefore = "always";
Hãy tự mình thử »
Định nghĩa và Cách sử dụng
Thuộc tính pageBreakBefore đặt hoặc trả về hành vi ngắt trang trước một phần tử (để in hoặc xem trước bản in).
Lưu ý: Thuộc tính pageBreakBefore không ảnh hưởng đến các phần tử được định vị tuyệt đối. Ngắt trang chỉ hiển thị trong bản xem trước khi in hoặc khi in.
Hỗ trợ trình duyệt
Property | |||||
---|---|---|---|---|---|
pageBreakBefore | Yes | Yes | Yes | Yes | Yes |
Cú pháp
Trả lại trangBreakBefore thuộc tính:
object.style.pageBreakBefore
Đặt thuộc tính pageBreakBefore:
object.style.pageBreakBefore = "auto|always|avoid|emptystring|left|right|initial|inherit"
Giá trị tài sản
Value | Description |
---|---|
auto | Insert a page break before the element if necessary. This is default |
always | Always insert a page break before the element |
avoid | Avoid a page break before the element |
"" (empty string) | Page break is not inserted before the element |
left | Insert one or two page breaks before the element, so the next page is considered a left page |
right | Insert one or two page breaks before the element, so the next page is considered 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 |
Chi tiết kỹ thuật
Giá trị mặc định: | Tự động |
---|---|
Giá trị trả lại: | Một chuỗi, đại diện cho hành vi ngắt trang trước một phần tử khi in |
Phiên bản CSS | CSS2 |
Các trang liên quan
Tham chiếu CSS: thuộc tính page-break-before
❮ Đối tượng phong cách