views:

273

answers:

2

I have an HTML table of data where each cell can have multiple lines of text. When the table is printed, it's possible for a row to be broken up so that some of the data appears at the bottom of the first page and some appears at the top of the next. Is there an equivalent to Word's "keep together" functionality that will prevent a page break from happening within a table row? I would think this would be a common problem, but the only "answer" I could find was hidden on a certain hyphenated web site. :)

Update: The data will be viewed using IE 7, which it appears does not handle the "page-break-inside" property correctly (if at all). Are there alternatives? Is this something jQuery can help with?

+2  A: 

try:

The CSS2-friendly way to do it would be
td { page-break-inside: avoid; }

see the page-break-inside definition

from: http://channel9.msdn.com/forums/TechOff/35322-Keep-with-next-when-printing-HTML-tables/

KM
Makes sense, but applying it doesn't seem to have any affect on the printed results. It's still breaking where it wants. I even added some other stuff to make sure the CSS element was being picked up (which it was), but it's not affecting the page breaks for some reason.
gfrizzle
Upon further investigation it appears this is not working because I'm using IE.
gfrizzle
+1  A: 

You may use CSS mediatypes to create printer friendly pages. A simple example is given in the following page. I believe it would help you solving the problem. http://martybugs.net/articles/print.cgi

Christy John
I'm already using a media="print" style sheet for some other printer-friendly styling. I'm trying to use "page-break-inside: avoid" here but it seems to have no affect.
gfrizzle