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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Print preview in css

Status
Not open for further replies.

dthomas31uk

Technical User
Oct 19, 2003
107
GB
Hi, Have created a webpage. Having problems getting my page styled to suit print preview

the print stylesheet is


the css is

the css for ie is


what I would like to achieve is to get the actual content of my page appear to the left of the print preview page in portrait view. Any ideas how I can achieve this??

I have a container which is centered on my actual screen layout, but cannot get it to appear to the left.

Hope someone can help cheers guys!
 
Your problem is casued by a combination of two things:

1. You are including your Print CSS before the regular CSS, and
2. Your regular CSS include does not specify any media types.

Thus, there are two ways to fix this:

1. Move your print CSS to after the regular CSS include, so that the margin declaration will overwrite that of the regular CSS, or
2. Give your regular CSS include a media type that doesn't include Print. At present, it has no media type speicified, so will be used for all media (including print), and thus overwrite the margins specified in the print CSS.

Personally, I'd do both of these things.

You might also want to consider adding "margin-right: 0px;" to your print CSS "#container" rule, too.

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
And don't forget that if the main css stylesheet has no media specified, it is considered to be media="all", which includes print. Since in print you do not redefine the width of the #container, that remains at 790px. I don't know what paper you're dealing with, but I am sure you can't say for sure that it is 790px wide. Try changing the #container width in print stylesheet to 100%. Every piece of paper is 100% wide.
 
cheers for the advice guys. It worked a treat, I have now managed to get it sorted..thanks to your help.

Once again cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top