始终在每个 id="footer" 的 <p> 元素后设置分页符:
document.getElementById("footer").style.pageBreakAfter = "always";
亲自试一试 »
pageBreakAfter 属性设置或返回元素后的分页行为(用于打印或打印预览)。
笔记:pageBreakAfter 属性对绝对定位的元素没有影响。分页符仅在打印预览或打印时可见。
Property | |||||
---|---|---|---|---|---|
pageBreakAfter | Yes | Yes | Yes | Yes | Yes |
返回 pageBreakAfter 属性:
object.style.pageBreakAfter
设置 pageBreakAfter 属性:
object.style.pageBreakAfter = "auto|always|avoid|emptystring|left|right|initial|inherit"
Value | Description |
---|---|
auto | Insert a page break after the element if necessary. This is default |
always | Always insert a page break after the element |
avoid | Avoid a page break after the element |
"" (empty string) | Page break is not inserted after the element |
left | Insert one or two page breaks after the element, so the next page is considered a left page |
right | Insert one or two page breaks after 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 |
默认值: | 汽车 |
---|---|
返回值: | 一个字符串,表示打印时元素后的分页行为 |
CSS版本 | CSS2 |
CSS 参考:page-break-after 属性
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!