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

CSS Printing margins

Status
Not open for further replies.

LTeeple

Programmer
Aug 21, 2002
362
CA
Happy Friday, all!

I am setting up a CSS for print media and have a quick question:

At this time, when the user prints the web page, I lose some text on the right side of the page, due to the margin settings.

I'd like to increase the printable area, and reduce margins. Could someone please provide me with either a link with sample css code, or post the sample css code here? I'd greatly appreciate it.

Thanks y'all!

[cheers]
Cheers!
Laura
 
can you post some of your code/link to the page? css makes more sense in context.

Here's some code I use to hide unnecessary stuff from printers.

Code:
<div id="main">
main content here
</div>
<div id="rightside">
rightside content
</div>

Code:
#main {margin-right: 200px;}
#rightside {position: absolute; right: 0;}

Code:
/* print CSS */
#main {margin-right: 0}
#rightside {display: none}

<marc> i wonder what will happen if i press this...[ul][li]please tell us if our suggestion has helped[/li][li]need some help? faq581-3339[/li][/ul]
 
Hi Mark,
My problem may be misunderstood. I want everything to print, but I'm losing stuff at the right column. I don't want to hide anything...

Thanks for your input, if you have any other suggestions, I'd appreciate it!

[cheers]
Cheers!
Laura
 
The print margins are set by the browser. The only margin I can think of is that on the body (corrected by body {margin: 0} )

The only thing I can think of is to make the page more flexible so the contents don't force the page to be so wide.

<marc> i wonder what will happen if i press this...[ul][li]please tell us if our suggestion has helped[/li][li]need some help? faq581-3339[/li][/ul]
 
Thanks again Marc.

Weird, the contents are all in a table - the width of the table container is 75%. the cells in the table are all relative width too.

I'm baffled!

[cheers]
Cheers!
Laura
 
can you post the code or a link? I'll take a look.

<marc> i wonder what will happen if i press this...[ul][li]please tell us if our suggestion has helped[/li][li]need some help? faq581-3339[/li][/ul]
 
I just figured out that if you open your page with IE, adjust the print margins under print preview and saveas, IE generates the print margin code for you (along with other changes).

Brian
 
Imagine printer is just another type of display. If layout cannot fit, browser attempts to rearrange it. If layout still cannot fit, horizontal scrollbar appers. Printer has no scrollbars, so it clips printout or prints multiple pages. Some math: web page resolution is 72dpi. Given width of standard A4 paper (210mm) and minimal margins (safe margin for laser printers is 0.25"), this translates into... 559px. You can try this:

- shrink print margins as much as possible
- play with CSS zoom property on BODY tag
- some browsers have option "Shrink to fit page width"
- buy A3 printer :)
 
The CSS zoom property not a W3C attribute.

It's "a Microsoft extension to Cascading Style Sheets (CSS)".

<marc> i wonder what will happen if i press this...[ul][li]please tell us if our suggestion has helped[/li][li]need some help? faq581-3339[/li][/ul]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top