42 users online (1 members and 41 guests)  


  Results 1 to 6 of 6

Related

  1. html page break    Forum: HTML Forum
    Replies: 3
  2. forced page break    Forum: CSS Forum
    Replies: 0
  3. opening new .html files inside a page    Forum: HTML Forum
    Replies: 9
  4. break time :(    Forum: General Discussion
    Replies: 4
  5. html scroll page inside a table?    Forum: HTML Forum
    Replies: 2
  1. #1
    ws_web's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2003
    Posts
    3

    Unhappy page-break-inside tbody

    I saw the "page-break-inside" property in a book and tried to apply it to a tbody tag to avoid that groups of 3 rows break between pages.

    When I access the page and do a print preview, nothing happens though. The groups of rows are still divided between pages.

    Is there any way that I could achieve this?

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Hiya, welcome to the forums.

    its kinda hard to judge whats going on without actully seeing your code. Do you have a link?
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  3. #3
    ws_web's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2003
    Posts
    3

    Question

    Thanks for your reply.

    I'm trying to avoid that the contents within the tbody tags split between pages.

    Here are the definitions for the tbody classes on the CSS:

    .dotted {
    background-color: #EFEFEF;
    color: #000000;
    page-break-inside: avoid;

    }
    .dotted2 {
    background-color: #CCCCCC;
    page-break-inside: avoid;
    }


    And, here's a piece of the code that gets printed on the page (including the heading row. A piece of perl code grabs the info from a database and prints the sets of 3 rows per record):

    <table border='1' frames='bottom' cellspacing='0' bordercolor='#000000'>
    <tr>
    <td valign='top'><p class='highlight' align='center'>CRN</p></td>
    <td valign='top'><p class='highlight' align='center'>Subj.</p></td>
    <td valign='top'><p class='highlight' align='center'>Num.</p></td>
    <td valign='top'><p class='highlight' align='center'>Sect.</p></td>
    <td valign='top'><p class='highlight' align='center'>Credit</p></td>
    <td colspan=2 valign='top'><p class='highlight' align='center'>Time</p></td>
    <td valign='top'><p class='highlight' align='center'>Days</p></td>
    <td valign='top'><p class='highlight' align='center'>Title</p></td>
    <td valign='top'><p class='highlight' align='center'>Instructor</p></td>
    <td valign='top'><p class='highlight' align='center'>Start-<br>End Dates</p></td>
    <td valign='top'><p class='highlight' align='center'>Location</p></td>
    <td valign='top'><p class='highlight' align='center'>Special<br>Fee</p></td>
    </tr>
    <tbody class=dotted>
    <tr>
    <td valign='top'><p><A HREF="JavaScript:windowOpen('http://128.59.202.34/prometheus/tccoursesyl/course.cfm?enter_crn=20030931281')" onMouseOver="window.status=''; return true" onMouseOut="window.status=''; return true">31281</a></p></td>
    <td valign='top'><p>A&HL</p></td><td valign='top'><p>4000</p></td>
    <td valign='top'><p>001</p></td><td valign='top'><p>3</p></td>
    <td colspan=2 valign='top'><p>07:20 pm-09:00 pm</p></td>
    <td valign='top'><p>R</p></td>
    <td valign='top'><p>Introduction to Linguistics</p></td>
    <td valign='top'><p>J Purdy</p></td>
    <td valign='top'><p>09/03-12/19</p></td>
    <td valign='top'><p>TBA-TBA</p></td>
    <td valign='top'><p>$15</p></td>
    </tr>
    <tr>
    <td valign='top'><p>&nbsp;</p></td>
    <td colspan=13 valign='top'><p>*</p></td>
    </tr>
    <tr>
    <td valign='top'><p>&nbsp;</p></td>
    <td colspan=13 valign='top'><p>Non TESOL/AL majors only. For TC degree students only.</p></td>
    </tr>
    </tbody>

    <tbody class=dotted2>
    <tr>
    <td valign='top'><p><A HREF="JavaScript:windowOpen('http://128.59.202.34/prometheus/tccoursesyl/course.cfm?enter_crn=20030930292')" onMouseOver="window.status=''; return true" onMouseOut="window.status=''; return true">30292</a></p></td>
    <td valign='top'><p>A&HL</p></td><td valign='top'><p>4005</p></td>
    <td valign='top'><p>001</p></td>
    <td valign='top'><p>3</p></td>
    <td colspan=2 valign='top'><p>05:10 pm-06:50 pm</p></td>
    <td valign='top'><p>T</p></td>
    <td valign='top'><p>Semantic Systems & The Lexicon</p></td>
    <td valign='top'><p>F Horowitz</p></td>
    <td valign='top'><p>09/03-12/19</p></td>
    <td valign='top'><p>TBA-TBA</p></td>
    <td valign='top'><p>$5</p></td>
    </tr>
    <tr>
    <td valign='top'><p>&nbsp;</p></td>
    <td colspan=13 valign='top'><p>*</p></td>
    </tr>
    <tr>
    <td valign='top'><p>&nbsp;</p></td>
    <td colspan=13 valign='top'><p>For TC degree students only.</p></td>
    </tr>
    </tbody>
    </table>

  4. #4
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    The problem with avoid is its only a suggestion. If the printer drivers run out of room, it will put a page-break in.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  5. #5
    ws_web's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2003
    Posts
    3

    Unhappy

    Too bad! Thanks for your reply, though.

    Quote Originally Posted by QuietDean
    The problem with avoid is its only a suggestion. If the printer drivers run out of room, it will put a page-break in.

  6. #6
    CaverX's Avatar
    New User

    Status
    Offline
    Join Date
    Sep 2003
    Posts
    1

    page-break-inside

    The problem is that although it is defined in the CSS standard, I don't think any browsers currently support it.

    Here is a script solution I wrote that works in IE, it is inserted in the window onload event handler. I have a set of paragraph tags that define sections I do not want to break between pages if possible. The 800 figure is kind of an eyeball to see how your screen coordinates correspond to the page.

    This way if it detects part of the paragraph falling on a page boundary, it forces a page break before that element.

    '***********
    'Determine how many vertical document positioning
    'units per printed page.
    'Iterate through document elements
    'Set page-break-before:always when object has
    'extended past page edge.

    dim pgCnt
    dim pgHeight
    dim collP

    pgHeight = 800
    pgCnt = 1
    set collP = document.getElementsByTagName("P")
    for each p in collP
    if p.offsetHeight < pgHeight then
    if (p.offsetTop / (pgCnt * pgHeight)) > 1 then
    p.style.pageBreakBefore = "always"
    pgCnt = pgCnt + 1
    end if
    end if
    next
    '***********

    Quote Originally Posted by ws_web
    I saw the "page-break-inside" property in a book and tried to apply it to a tbody tag to avoid that groups of 3 rows break between pages.

    When I access the page and do a print preview, nothing happens though. The groups of rows are still divided between pages.

    Is there any way that I could achieve this?



Tags for this Thread