Page-Break-inside property is not working in chrom

2019-02-21 21:22发布

I have a long table data, which having many of the rows and nested tables. When I am printing this data then the rows of the table and nested tables are just break on the page break, means tables and data are split into pages, So I use following CSS property there:-

table tr {
 page-break-inside:avoid;
 position:relative;
 }

But this is not working in my case, you can see the live demo here:--http://jsfiddle.net/npsingh/S8vr8/2/show/

Please edit the code by following link:--
http://jsfiddle.net/npsingh/S8vr8/2/
---[For Print the page just press [CTRL+P] or right click and click on Print option]---

I am using Google Chrome Version 29.0.1547.66 m

Please let me know where the problem exactly. Thanks

2条回答
We Are One
2楼-- · 2019-02-21 21:42

This did the trick for me it turned out to be the body css:

body{
    height: auto!important;
    float: none!important;
}
查看更多
我想做一个坏孩纸
3楼-- · 2019-02-21 21:46

Instead of putting the page-break-inside:avoid; on you table's tr, try applying it on the table directly like this:

table {
    page-break-inside:avoid;
    position:relative;
}

also add this media query:

@media print {
   table {
        page-break-inside:avoid;
        position:relative;
    }
}
查看更多
登录 后发表回答