Results 1 to 5 of 5

Thread: Howto avoid Page break inside <tr>

  1. #1
    Join Date
    Aug 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Howto avoid Page break inside <tr>

    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..

  2. #2
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Vijayaraj
    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,

    Code:
    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

  3. #3
    Join Date
    Aug 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    After that also it is printing same..

  4. #4
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    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
    Code:
    .break{
    display: block;
    page-break-after: always;
    }
    Note: I haven't tested that

  5. #5
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by blm126
    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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •