SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard triexa's Avatar
    Join Date
    Dec 2002
    Location
    Canada
    Posts
    2,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Avoid page breaks?

    I know not everything is widely supported but this is actually mostly for internal usage.

    I know the css property page-break-before... which has come in handy quite a bit! However, is there some way to avoid page breaking within an element? For example, if a table starts near the end of the page, it could span halfway on to the next. I'd MUCH rather have the entire table on the next page.

    Any way to do this?
    AskItOnline.com - Need answers? Ask it online.
    Create powerful online surveys with ease in minutes!
    Sign up for your FREE account today!
    Follow us on Twitter

  2. #2
    Non-Member
    Join Date
    Oct 2007
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm sure you know this already, but just in case; The page-break-before property is only for print and does not effect browser usage.

  3. #3
    SitePoint Wizard triexa's Avatar
    Join Date
    Dec 2002
    Location
    Canada
    Posts
    2,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes I thought it was implied - but this is for setting up documents to print.

    My problem is I have some <table> elements which span multiple pages - I'd like to force the entire table on to a page, putting a page break before if necessary.

    I came across page-break-inside, but it seemed to have zero effect...
    AskItOnline.com - Need answers? Ask it online.
    Create powerful online surveys with ease in minutes!
    Sign up for your FREE account today!
    Follow us on Twitter

  4. #4
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The page-break-inside property is the one you're looking for. It can tell the browser to avoid inserting a page break inside an element – if possible.

    The bad news is that the only browser supporting this is Opera. (I don't know about IE8; Microsoft claims 100&#37; CSS2.1 compliance with that one, but I haven't had a chance to test it.)
    Birnam wood is come to Dunsinane

  5. #5
    SitePoint Wizard triexa's Avatar
    Join Date
    Dec 2002
    Location
    Canada
    Posts
    2,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah - that would explain it. A little surprised Firefox doesn't support it. Ah well, I'll see what I can work with - maybe I'll just try to remember to print the document using opera
    AskItOnline.com - Need answers? Ask it online.
    Create powerful online surveys with ease in minutes!
    Sign up for your FREE account today!
    Follow us on Twitter


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
  •