Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Three on a page for printing?

Status
Not open for further replies.

OsakaWebbie

Programmer
Feb 11, 2003
628
JP
I'm on a really tight deadline on this, so I abandoned my original idea to learn how to make a PDF and went with HTML, even though I know printing is unpredictable. (I can control the browser and print settings - it will only be used for about two days on one computer and printer.)

I'm trying to get three sections of data (from a database - the real data will contain hundreds or thousands of them at once) consistently placed on A4-sized pages, to be printed and cut apart. But my method of three position:absolute divs inside a position:relative div only works for the first page. In Firefox, the sections on subsequent pages all start from somewhere slightly above the top of the page, stacked on top of each other. In IE the page-break-before:always is not honored at all. Opera does something funny with the box model, and also doesn't appear to honor the page break. Can someone see what's wrong, or have a better idea of how to get these documents to line up three on a page consistently on one browser or another? I tried nesting the position-relative div in another div that just had the page breaks and no positioning, in case they were interfering with each other somehow, but at least in Firefox, that didn't seem to make any difference.

The real code is password-protected PHP, but I saved a test page at
 
Yeah, the person for whom I was preparing it offered to do mail merge if I could get the data out in CSV format. But I knew I had to be close to getting the layout working in HTML, so I kept researching. I eventually figured out that I needed to have some content in the position:relative div - a simple   was sufficient. Apparently page breaks are ignored if the div on which the page break is assigned has no "in flow" content but only floats or position:absolute elements.

Also, for some reason, even after that fix, the alignment of my first page and the others was a bit different, so I compensated in my "top" parameter. It looks okay now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top