page-break-before和page- break-after 实现分页打印

page- break-before和page-break-after CSS属性并不会修改网页在屏幕上的显示,这两个属性是用来控制文件的打印方式。每个打印属性都可以设定4种设定值:auto、always、left和 right。其中Auto是默认值,只有在有需要时,才需设定分页符号 (Page breaks)。page-break-before若设定成always,则是在遇到特定的组件时,打印机会重新开始一个新的打印页。page- break-before若设定成left,则会插入分页符号,直到指定的组件出现在一个左边的空白页上。page-break-before若设定成 right,则会插入分页符号,直到指定的组件出现在一个右边的空白页上。page-break-after属性会将分页符号加在指定组件后,而非之前。 在下列

程序中您将可以看到这些属性的设定,

 

<HTML>

<HEAD>

<TITLE>Listing 14-4</TITLE>

</HEAD>

<BODY>

<DIV>This is the first DIV.</DIV>

<DIV STYLE="page-break-before:always">This is the second DIV.</DIV>

<DIV STYLE="page-break-after:always">This is the third DIV.</DIV>

<DIV>This is the fourth DIV.</DIV>

<DIV STYLE="page-break-before:right">This is the fifth DIV.</DIV>

<DIV STYLE="page-break-after:right">This is the sixth DIV.</DIV>

<DIV>This is the last DIV.</DIV>

</BODY>

</HTML>

 

可用值

 

描述
autoInsert a page break after the element if necessary
假如需要 在对象之后插入页分割符
alwaysInsert a page break after the element
始终在对象之后插入页分割符
avoidAvoid inserting a page break after the element
避免在对象后面插入页分割符
leftInsert page breaks after the element until it reaches a blank left page
在对象后面插入页分割符直到它到达一个空白的左页边
rightInsert page breaks after the element until it reaches a blank right page
在对象后面插入页分割符直到它到达一个空白的右页边
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值