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

前端 未结 12 2032
有刺的猬
有刺的猬 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:23

    I checked many solutions and anyone wasn't working good.

    So I tried a small trick and it works:

    tfoot with style:position: fixed; bottom: 0px; is placed at the bottom of last page, but if footer is too high it is overlapped by content of table.

    tfoot with only: display: table-footer-group; isn't overlapped, but is not on the bottom of last page...

    Let's put two tfoot:

    TFOOT.placer {
      display: table-footer-group;
      height: 130px;
    }
    
    TFOOT.contenter {
      display: table-footer-group;
      position: fixed;
      bottom: 0px;	
      height: 130px;
    }
     
      
        
          
        
      
    	
     
      
        
          your long text or high image here
        
      
    

    One reserves place on non-last pages, second puts in your accual footer.

提交回复
热议问题