madewulf
madewulf

Reputation: 1910

CSS to specify full page width at printing?

I have an HTML page that is printed pretty well thanks to print specific styling except for one thing: it does not use the full width of the page. In other words, I would like the page to be scaled to fill the page.

Is it possible to obtain that result using CSS styles?

Upvotes: 2

Views: 14430

Answers (2)

Tivie
Tivie

Reputation: 18923

Actually you can, with the @page CSS rule, although it can change a bit between browser implementation.

You can set this in your CSS:

@page { 
    size:210mm 297mm; 
    margin: 0;
}

This will set the size of the page as A4 with no margins

Upvotes: 5

James Culshaw
James Culshaw

Reputation: 1057

I know in IE you cannot control things such as the default page margins that are set via the print dialog. These are usually 2cm and can only be overriden by the actual user in the print dialog. Other than that setting the main containers (html, body, etc.) to be width:100% and margin and padding to be 0 is the only other thing that you can do. Remember though that the margin set in CSS for html/body are within the print area of the page as defined in the print settings for the user.

Upvotes: 0

Related Questions