?
Solved

Page break when printing page-break-inside:avoid

Posted on 2012-09-20
4
Medium Priority
?
374 Views
Last Modified: 2013-09-03
HI, I am trying to print a document with mutliple tables. I don't want it to page break within a table when printing. (It should hold the table to the next page if necessary). Is there anyway to accomplish this? I have been playing with page-break-inside but with no results. I need it to work in all version of IE but no other browser.   This is my code:
<style type="text/css" media="print">

{

table {position:relative;page-break-inside:avoid}
td{background-Color:red;}

}
</style>

Any suggestions? Please! Thank you.

The full page is below (just a sample page with nothing on it but the <p>'s  and the table.)


<HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
<HEAD>
<style type="text/css" media="print">

{

table {position:relative;page-break-inside:avoid}
td{background-Color:red;}

}
</style>

</HEAD>
<BODY>
A
A
A
A
A
AA

A
A
A
A
A
A
A
A
A
A
A
A<P>
A<P>
A<P>
A<P>

A<P>
A<P>
A<P>
A<P>

A<P>
A<P>
A<P>
A<P>
A<P>
A<P>
A<P>
A<P>
A<P>
A<P>
A<P>
A<P>

A<P>
A<P>
A<P>
A<P>

A<P>
A<P>
A<P>
A<P>

A<P>
A<P>
A<P>
A<P>
A<P>
A<P>
A<P>
A<P>
A<P>
A<P>
A<P>
A<P>
A<P>

<TABLE CLASS="table" BORDER=1><Tr><TD>A8</TD></TR><Tr><TD>A9</TD></TR><Tr><TD>A10</TD></TR><Tr><TD>A11</TD></TR></TABLE>
A<P>


A<P>
A<P>
A<P>

A<P>
A<P>
A<P>
A<P>
A1<P>
A2<P>
A3<P>
A4<P>
A<P>
A<P>
A<P>
A<P>
A<P>
A<P>
A<P>
A<P>

A<P>
A<P>
A<P>
A<P>

A<P>
A<P>
A<P>
A<P>
A<P>
A<P>
A<P>
A<P>
A<P>
A<P>
A<P>
A<P>
</BODY>
</HTML>
0
Comment
Question by:AlizaN
2 Comments
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 2000 total points
ID: 38418937
AFAIK the only browser that supports page-break-inside is Opera.

Trying to control the print of web pages is like trying to push a string.  If you need precision then use a pdf instead of an HTML page.

If you  don't mind the security risks of ActiveX you could try this: http://scriptx.meadroid.com/home.aspx


Cd&
0
 
LVL 1

Author Comment

by:AlizaN
ID: 38419930
That's great, we use them already - I'm going to check out what they have to offer. And it's good to know when we are beating our heads against a wall too, so that information is appreciated also.  Thank you!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question