zoukankan      html  css  js  c++  java
  • css控制页面打印(分页、屏蔽不需要打印的对象)

    样式:

    <style   media="print">   
      .Noprint   {   DISPLAY:   none;}   
      .PageNext   {   PAGE-BREAK-AFTER:   always   }   
    </style>  

    注:

    ①、不需要打印的对象要用上“Noprint”样式。

    ②、需要换页处理的对象要用上“PageNext”样式。

    ③、因为最后一页不用加入换页符,所以要控制最后一页不要使用该样式。个人感觉用PAGE-BREAK-BEFORE属性控制第一页要方便一些。

    =====================================================================================

    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属性会将分页符号加在指定组件后,而非之前。

    设置为left或right 与 设置为alvays究竟有什么区别,上面红色字体的说明看不明白,希望看到贴字的明白人指点一二。

    不过用“always”值再加以控制一般的问题都能解决,以下为例子:

    <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-before: always">
            This is the third DIV.</div>
        <div style="page-break-before: always">
            This is the fourth DIV.</div>
    </body>
    </html>
    

      


    <html>
    <head>
        <title>Listing 14-4</title>
    </head>
    <body>
        <div style="page-break-after: always">
            This is the first DIV.</div>
        <div style="page-break-after: 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>
    </body>
    </html>
    

      程序员的基础教程:菜鸟程序员

  • 相关阅读:
    SVM+HOG特征训练分类器
    数字图像处理的基本原理和常用方法
    c++中二进制和整数转化
    目标检测——HOG特征
    相似图片搜索的原理和实现——颜色分布法
    测试文本文件大小
    Direct2D 图形计算
    Direct2D 如何关闭抗锯齿
    MFC窗口显隐
    CISP/CISA 每日一题 22
  • 原文地址:https://www.cnblogs.com/guohu/p/5748955.html
Copyright © 2011-2022 走看看