目录

CSS break-after 属性


示例

始终在 <footer> 元素后插入分页符:

@media print {
  footer {
    break-after: always;
  }
}


定义和用法

这个break-after属性指定在指定元素之后是否应出现分页符、列符或区域符。

这个break-after属性扩展了CSS2 page-break-after属性。

使用break-after,您可以告诉浏览器在该元素之后打破页面、列或区域break-after属性应用于,或避免元素被拆分并跨越两个页面。

默认值: 汽车
遗传:
可动画: 不。阅读可动画的
版本: CSS3
JavaScript 语法: 对象.style.breakAfter="always"

浏览器支持

表中的数字指定完全支持该属性的第一个浏览器版本。

Property
break-after 50.0 10.0 65.0 10.0 37.0


CSS 语法

break-after: auto|all|always|avoid|avoid-column|avoid-page|avoid-region|column|left|page|recto|region|right|verso|initial|inherit;

属性值

Value Description
auto Default. Automatic page/column/region break after the element
all Always insert a page-break right after the principal box
always Always insert a page-break after the element
avoid Avoid a page/column/region break after the element
avoid-column Avoid a column-break after the element
avoid-page Avoid a page-break after the element
avoid-region Avoid a region-break after the element
column Always insert a column-break after the element
left Insert one or two page-breaks after the element so that the next page is formatted as a left page
page Always insert a page-break after the element
recto Insert one or two page-breaks after the principal box so that the next page is formatted as a recto page
region Always insert a region-break after the element
right Insert one or two page-breaks after the element so that the next page is formatted as a right page
verso Insert one or two page-breaks after the principal box so that the next page is formatted as a verso page
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

更多示例

示例

始终在 id "toc"(目录)的元素后插入分页符:

@media print {
  #toc {
    break-after: always;
  }
}

示例

始终在区域中的 <ul> 元素之后插入区域分隔符:

.region ul {
    break-after: region;
  }
}