/    Sign up×
Community /Pin to ProfileBookmark

page printing question

I have a website with 4 tables, all of which are dynamically genererated, so essentially I never know how many rows(how long) the table is going to be. What I need help with is, I would like to use CSS to force a page break before a table if it is going to be split onto more than one page. So that way the table would start on a new page, and hopefully not be split at all, but only be split if it were longer than one whole page.

I’ve tried quite a few things revolving around page-break-inside… page-break-before, so please try to be somewhat specific. Thanks.

to post a comment
CSS

2 Comments(s)

Copy linkTweet thisAlerts:
@Frantic211Aug 11.2005 — What kind language are you using for the back end?

I did something similar in a jsp. I had the list of cases(rows of the table) and I figured out how many could nicely fit on the printed page. Then, as I was displaying them I checked to see if the page was full with the mod(%) function in java and if it was I closed the table </table> and then inserted <BR STYLE="page-break-after:always"> <table> and continued to loop through the list.

Hope this helps...
Copy linkTweet thisAlerts:
@wardoauthorAug 11.2005 — No it doesn't sorry, but thanks for the input... Rows may not be of the same size. I just want to see if it's possible to force a table to stay together, on one page and not be split up. Also, even if you cant solve my problem what is it that page-break-inside is supposed to do, specifically when set to avoid.
×

Success!

Help @wardo spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...