Log in

View Full Version : Howto avoid Page break inside <tr>



Vijayaraj
08-08-2006, 11:56 AM
Hi,
I want to print the HTML page which contain the <table><tr><td>... In this page while printing Last line of that page is cut of then remaning half is printed in the next page. so we are not able to read the content.
Now i am trying the avoid printing like that, so page break inside <TR> should not allow. only page break allowed is before or after the <tr>

Please Help me..

mwinter
08-08-2006, 12:39 PM
Now i am trying the avoid printing like that, so page break inside <TR> should not allow. only page break allowed is before or after the <tr>

It is possible to suggest page break behaviour using the page-break-* CSS properties. For example,



tr {
page-break-inside: avoid;
}

may prevent inserting a break in any table row anywhere in the document.

I say may for a few reasons: I haven't tested this; the page-break-* properties apply to block-level elements, yet table rows are technically in their own category; and browsers may not support the property. However, aside from using a format like PDF, this is perhaps your best bet in HTML.

Mike

Vijayaraj
08-09-2006, 04:49 AM
After that also it is printing same..

blm126
08-09-2006, 04:22 PM
The problem is that page-break-inside has bad browser support. page-break-after appears to have better browser support. So you could force page breaks to try and make sure the content was all on one page


.break{
display: block;
page-break-after: always;
}

Note: I haven't tested that

mwinter
08-10-2006, 02:02 AM
The problem is that page-break-inside has bad browser support. page-break-after appears to have better browser support.

Yes, but the result might be radically different. For instance, printing on smaller paper may cause a previous row to span pages, with the following row prematurely breaking.

If this is so very important, the OP should accept that HTML and CSS cannot reliably provide the necessary functionality, and another format specifically geared towards printing (like PDF) should be considered instead.

Mike