Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    May 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question CSS and Page breaks

    I am trying to dynamically assign page breaks for a page that has several tables. Goal is if table grows beyond a page to insert a break and start the table on a new page. I hav tried several combinations of using page-break-always in my css page wrapping a div around every table, like so:

    div {
    page-break-after: always;
    }

    table {
    page-break-after: auto;
    }


    and also div tags inbetween tables, like so:

    <DIV style="page-break-after:auto"></DIV>.


    I feel I am close, but it's not working correctly. It still runs a table over from one page to the next.



    Does that make sense? Any ideas?

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    can you show us your full code please, or give us a link so we can test different solutions.

  • #3
    New to the CF scene
    Join Date
    May 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <style type="text/css">
    div {
    page-break-after: always;
    }

    table {
    page-break-after: auto;
    }

    tr {
    font-family : Arial, Helvetica, sans-serif;
    font-size : 16;
    text-align : left;
    }

    td {
    font-family: Arial;
    font-size: 16;
    font-weight: bold;
    padding: 2px;
    text-align : left;
    }
    </style>



    <div>
    <table>
    <tr>
    <td>some table content</td>
    </tr>
    </table>
    </div>


    <div>
    <table>
    <tr>
    <td>some table content</td>
    </tr>
    </table>
    </div>


    <div>
    <table>
    <tr>
    <td>some table content</td>
    </tr>
    </table>
    </div>


    <div>
    <table>
    <tr>
    <td>some table content</td>
    </tr>
    </table>
    </div>

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Hmm that should work, at least when I go to print preview it shows 5 pages being printed only because the last page comes from the page break after the last table. You might want to set a height to the divs so as its no larger than a 81/2 by 11in sheet of paper.


  •  

    Posting Permissions

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