简体   繁体   中英

Avoid table border split on page break while printing

My content is already on the same page, that's not what the problem is. (Some other questions on SO tackle that). My issue is with borders specificaly. See how the table border splits row 43 in two.

在此处输入图片说明

I would like 43 to be on the next page completely. 42 should have a bottom border and 43 should have a top border. Here is what I want. (I created this in paint)

在此处输入图片说明

I tried page break inside: avoid but that doesn't work. Neither does the 4px trick works. I am in latest stable chrome. 51

Could you please try this css code:

<html>
<head>
<style>
@media print
{
  table { page-break-after:auto }
  tr    { page-break-inside:avoid; page-break-after:auto }
  td    { page-break-inside:avoid; page-break-after:auto }
  thead { display:table-header-group }
  tfoot { display:table-footer-group }
}
</style>
</head>

<body>
....
</body>
</html>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM