📜  CSS |分页后属性

📅  最后修改于: 2021-08-30 12:42:09             🧑  作者: Mango

CSS 中的page-break-after属性用于在指定元素之后添加一个分页符。

类似地,page-break-before、page-break-after 和 page-break-inside 这三个属性都有助于确定并因此定义结果文档在打印时的方式。

注意: page-break-after 属性不能用于绝对定位的元素或空的

元素。

语法

page-break-after: auto|always|avoid|left|right|initial|inherit;

属性值

  • auto :这个值是指自动分页。
    page-break-after:auto;
    

    示例

    
    
    
        
            page-break-after: auto
        
    
      
    
      
        

            The oldest classical Greek and Latin          writing had little or no space between         words and could be written in boustrophedon         (alternating directions). Over time, text         direction (left to right) became standardized,         and word dividers and terminal punctuation          became common. The first way to divide sentences         into groups was the original paragraphos,          similar to an underscore at the beginning of         the new group.[2] The Greek paragraphos          evolved into the pilcrow, which in English          manuscripts in the Middle Ages can be seen          inserted inline between sentences. The hedera          leaf (e.g. ?) has also been used in the same way.     

      Text credits: https://en.wikipedia.org/wiki/Paragraph                     
  • always:使用此值时,始终在指定元素框后插入分页符。
    page-break-after:always;
    

    示例

    
    
    
        
            page-break-after: always
        
    
      
    
        

            The oldest classical Greek and Latin          writing had little or no space between         words and could be written in boustrophedon         (alternating directions). Over time, text         direction (left to right) became standardized,         and word dividers and terminal punctuation          became common. The first way to divide sentences         into groups was the original paragraphos,          similar to an underscore at the beginning of         the new group.[2] The Greek paragraphos          evolved into the pilcrow, which in English          manuscripts in the Middle Ages can be seen          inserted inline between sentences. The hedera          leaf (e.g. ?) has also been used in the same way.     

               

            The oldest classical Greek and Latin          writing had little or no space between         words and could be written in boustrophedon         (alternating directions). Over time, text         direction (left to right) became standardized,         and word dividers and terminal punctuation          became common. The first way to divide sentences         into groups was the original paragraphos,          similar to an underscore at the beginning of         the new group.[2] The Greek paragraphos          evolved into the pilcrow, which in English          manuscripts in the Middle Ages can be seen          inserted inline between sentences. The hedera          leaf (e.g. ?) has also been used in the same way.     

               Text credits : https://en.wikipedia.org/wiki/Paragraph                     
  • 避免:使用此值时,尽可能避免分页。
    page-break-after:avoid;
    

    示例

    
    
    
        
            page-break-after: avoid
        
    
      
    
        

            The oldest classical Greek and Latin          writing had little or no space between         words and could be written in boustrophedon         (alternating directions). Over time, text         direction (left to right) became standardized,         and word dividers and terminal punctuation          became common. The first way to divide sentences         into groups was the original paragraphos,          similar to an underscore at the beginning of         the new group.[2] The Greek paragraphos          evolved into the pilcrow, which in English          manuscripts in the Middle Ages can be seen          inserted inline between sentences. The hedera          leaf (e.g. ?) has also been used in the same way.     

               

            The oldest classical Greek and Latin          writing had little or no space between         words and could be written in boustrophedon         (alternating directions). Over time, text         direction (left to right) became standardized,         and word dividers and terminal punctuation          became common. The first way to divide sentences         into groups was the original paragraphos,          similar to an underscore at the beginning of         the new group.[2] The Greek paragraphos          evolved into the pilcrow, which in English          manuscripts in the Middle Ages can be seen          inserted inline between sentences. The hedera          leaf (e.g. ?) has also been used in the same way.     

               Text credits :https://en.wikipedia.org/wiki/Paragraph                     
  • left:使用此值时,插入分页符,以便将下一页描绘为左页。
    page-break-after:left;
    

    示例

    
    
    
        
            page-break-after: left
        
    
      
    
        

            The oldest classical Greek and Latin          writing had little or no space between         words and could be written in boustrophedon         (alternating directions). Over time, text         direction (left to right) became standardized,         and word dividers and terminal punctuation          became common. The first way to divide sentences         into groups was the original paragraphos,          similar to an underscore at the beginning of         the new group.[2] The Greek paragraphos          evolved into the pilcrow, which in English          manuscripts in the Middle Ages can be seen          inserted inline between sentences. The hedera          leaf (e.g. ?) has also been used in the same way.     

               

            The oldest classical Greek and Latin          writing had little or no space between         words and could be written in boustrophedon         (alternating directions). Over time, text         direction (left to right) became standardized,         and word dividers and terminal punctuation          became common. The first way to divide sentences         into groups was the original paragraphos,          similar to an underscore at the beginning of         the new group.[2] The Greek paragraphos          evolved into the pilcrow, which in English          manuscripts in the Middle Ages can be seen          inserted inline between sentences. The hedera          leaf (e.g. ?) has also been used in the same way.     

               Text credits :https://en.wikipedia.org/wiki/Paragraph                     
  • 右:使用此值插入分页符,以便将下一页描绘为左页。
    page-break-after:right;
    

    示例

    
    
    
        
            page-break-after: right
        
    
      
    
        

            The oldest classical Greek and Latin          writing had little or no space between         words and could be written in boustrophedon         (alternating directions). Over time, text         direction (left to right) became standardized,         and word dividers and terminal punctuation          became common. The first way to divide sentences         into groups was the original paragraphos,          similar to an underscore at the beginning of         the new group.[2] The Greek paragraphos          evolved into the pilcrow, which in English          manuscripts in the Middle Ages can be seen          inserted inline between sentences. The hedera          leaf (e.g. ?) has also been used in the same way.     

               

                   The oldest classical Greek and Latin          writing had little or no space between         words and could be written in boustrophedon         (alternating directions). Over time, text         direction (left to right) became standardized,         and word dividers and terminal punctuation          became common. The first way to divide sentences         into groups was the original paragraphos,          similar to an underscore at the beginning of         the new group.[2] The Greek paragraphos          evolved into the pilcrow, which in English          manuscripts in the Middle Ages can be seen          inserted inline between sentences. The hedera          leaf (e.g. ?) has also been used in the same way.     

               Text credits :https://en.wikipedia.org/wiki/Paragraph                     
  • initial :如果使用此值,则该属性将设置为默认值。
    page-break-after:initial;
    

    示例

    
    
    
        
            page-break-after: initial
        
    
      
    
        

            The oldest classical Greek and Latin          writing had little or no space between         words and could be written in boustrophedon         (alternating directions). Over time, text         direction (left to right) became standardized,         and word dividers and terminal punctuation          became common. The first way to divide sentences         into groups was the original paragraphos,          similar to an underscore at the beginning of         the new group.[2] The Greek paragraphos          evolved into the pilcrow, which in English          manuscripts in the Middle Ages can be seen          inserted inline between sentences. The hedera          leaf (e.g. ?) has also been used in the same way.     

               

            The oldest classical Greek and Latin          writing had little or no space between         words and could be written in boustrophedon         (alternating directions). Over time, text         direction (left to right) became standardized,         and word dividers and terminal punctuation          became common. The first way to divide sentences         into groups was the original paragraphos,          similar to an underscore at the beginning of         the new group.[2] The Greek paragraphos          evolved into the pilcrow, which in English          manuscripts in the Middle Ages can be seen          inserted inline between sentences. The hedera          leaf (e.g. ?) has also been used in the same way.     

               Text credits :https://en.wikipedia.org/wiki/Paragraph                     
  • inherit :属性从父元素继承
    page-break-after:inherit;
    

    示例

    
    
    
        css_page_break_after
        
    
      
    
        

            The oldest classical Greek and Latin          writing had little or no space between         words and could be written in boustrophedon         (alternating directions). Over time, text         direction (left to right) became standardized,         and word dividers and terminal punctuation          became common. The first way to divide sentences         into groups was the original paragraphos,          similar to an underscore at the beginning of         the new group.[2] The Greek paragraphos          evolved into the pilcrow, which in English          manuscripts in the Middle Ages can be seen          inserted inline between sentences. The hedera          leaf (e.g. ?) has also been used in the same way.     

        
            

            The oldest classical Greek and Latin          writing had little or no space between         words and could be written in boustrophedon         (alternating directions). Over time, text         direction (left to right) became standardized,         and word dividers and terminal punctuation          became common. The first way to divide sentences         into groups was the original paragraphos,          similar to an underscore at the beginning of         the new group.[2] The Greek paragraphos          evolved into the pilcrow, which in English          manuscripts in the Middle Ages can be seen          inserted inline between sentences. The hedera          leaf (e.g. ?) has also been used in the same way.     

               

            The oldest classical Greek and Latin          writing had little or no space between         words and could be written in boustrophedon         (alternating directions). Over time, text         direction (left to right) became standardized,         and word dividers and terminal punctuation          became common. The first way to divide sentences         into groups was the original paragraphos,          similar to an underscore at the beginning of         the new group.[2] The Greek paragraphos          evolved into the pilcrow, which in English          manuscripts in the Middle Ages can be seen          inserted inline between sentences. The hedera          leaf (e.g. ?) has also been used in the same way.     

                 Text credits :https://en.wikipedia.org/wiki/Paragraph                     

注意:通过选择给定 HTML 代码的网页的打印预览,可以最好地查看 page-break-after 属性的结果。在记事本++等文本编辑器上创建类似的代码,并选择对创建的网页进行打印预览。为了更好的理解,请尝试一下。

支持的浏览器: page-break-after 属性支持的浏览器如下:

  • 谷歌浏览器
  • IE浏览器
  • 火狐
  • 歌剧
  • 苹果浏览器