Solved

CSS Printing Web Page Content, Cuts off lines.

Posted on 2006-07-24
5
411 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
  • 3
  • 2
5 Comments
 
LVL 30

Accepted Solution

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

Author Comment

by:JF0
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Add space before submit button 3 40
Adding a menu section 13 34
Problem to ToolkitScriptManager 2 28
Wordpress CSS Link Issue 2 13
When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
In this Micro Tutorial users will learn how to embed custom fonts into websites using @font-face in CSS Select a font: Ensure the EULA allows you to use @font-face: Download the font: Get the browser-compatible files you need: Edit your CSS       - Name …
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now