How to deal with page breaks when printing a large HTML table

前端 未结 12 2051
有刺的猬
有刺的猬 2020-11-22 16:44

I have a project which requires printing an HTML table with many rows.

My problem is the way the table is printed over multiple page. It will sometimes cut a row in

12条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-22 17:25

    Expanding from Sinan Ünür solution:

    
    
    
    
    Test
    
    
    
        
    heading
    notes
    Long
    cell
    should'nt
    be
    cut
    Long
    cell
    should'nt
    be
    cut
    x

    It seems that page-break-inside:avoid in some browsers is only taken in consideration for block elements, not for cell, table, row neither inline-block.

    If you try to display:block the TR tag, and use there page-break-inside:avoid, it works, but messes around with your table layout.

提交回复
热议问题