Solved

CSS Printing Web Page Content, Cuts off lines.

Posted on 2006-07-24
5
423 Views
Last Modified: 2008-02-26
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.
0
Comment
Question by:JF0
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 30

Accepted Solution

by:
GrandSchtroumpf earned 250 total points
ID: 17173380
remove all absolute positioning and it should work correctly.
0
 
LVL 16

Author Comment

by:JF0
ID: 17175375
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.)
0
 
LVL 16

Author Comment

by:JF0
ID: 17175447
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.
0
 
LVL 30

Expert Comment

by:GrandSchtroumpf
ID: 17175771
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...
0
 
LVL 16

Author Comment

by:JF0
ID: 17179303
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.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…

688 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