Link to home
Start Free TrialLog in
Avatar of JF0
JF0Flag for United States of America

asked on

CSS Printing Web Page Content, Cuts off lines.

Hello,

I am trying to set the styles for a page to print. I have the CSS set to print just the main column.

 @media print{

  #leftcol, #top, #footer { display: none; }  
  #maincol { position:absolute;  top:0; float:left;  width:6.25in; }

}



The html consists of about 8 or 9 pieces of code just like the following:

<div class="depttitle">Win Cramer - Director of Purchasing</div>
<img src="/images/win-cramer.jpg" class="leadership">
<p>Win began his career here in 2000 as an Associate Buyer, mentoring under the VP of materials. He was promoted to the management team in 2002 as Director of Purchasing. <br><br>
Win oversees the Purchasing department, and is responsible for raw material product procurement and assembly into finished inventory.  Additionally, Win works closely with a global supply team that is responsible for the creation and design of experience-enhancing consumer products under the company's  brand.   On a daily basis Win supports the sales force in keeping pace with the volatile RAM, Flash, and consumer products markets. <br><br>
Win graduated from the University of Oklahoma, and enjoys riding motorcycles, camping, fishing and spending time with his wife.</p>

The problem in IE, is that the final line on a page usually is split in half, horizontally. the line height is half on the bottom of the page, and half at the top of the following page. In FF, the printing is completely messed up. I have tried inserting some of the page-break-after / page-break-before elements to specify exactly where to make the page break, but have been unsuccessful in getting them to work. I also assume there is some margin attribute to tell the browser not to extend to the farthest point vertically on the page.

Any help would be great, thanks.
ASKER CERTIFIED SOLUTION
Avatar of GrandSchtroumpf
GrandSchtroumpf

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JF0

ASKER

that works great in IE, except the position on the first page where it starts is probably about 3 inches down (i think because i have a css dropdown menu at the top?) but that is ok.

Still is VERY messed up when i print preview in FF. In FF print preview, the text runs between the images of the pages, like printing on air if that makes sense. (will except your answer for main answer, and award additional points if someone can fix my FF problem.)
Avatar of JF0

ASKER

Also is cut off on the right side in FF and shows the top menu on a page by itself, whereas in IE doesnt show it at all.
Avatar of GrandSchtroumpf
GrandSchtroumpf

Printing works best with very simple layouts.

> Also is cut off on the right side in FF
Make sure your width is set to "auto".

> and shows the top menu on a page by itself
That happens a lot in FF and it's very hard to know exactly why it happens and how to fix it.
The best solution i found is to use the least "container" elements as possible and avoid using borders.
But even with that, i get some unwanted page-breaks on some pages...

For a more detailed answer, we should get a link to a page that has the problems you described...
Avatar of JF0

ASKER

Sorry, its an intranet page, and i don't have an outside server with asp support.

The width is set to 6.25in

The only div i want to print on any of my pages is the main column (maincol). When i do print preview, I can actually hover over my menu and watch it change, it is real weird.