A4 formatting

How can I encode a CSS style to force certain page margins for a web page to print and be valid for IE and Firefox?

+4
source share
2 answers

Use the print media type (@media print).

Do not set a fixed width and maximum width. Make the contents instead. If you specify any with (px, em, pt, cm), you will always encounter one or the other problem, because different browsers add different fields.

A4, letter, A3, this is not your concern. Your document doesn't care. The user can print the document on any paper available to him, because your content is fluid.

Find some CSS tips for printing here.

+4
source

One way to solve the problem is to use SVG. With SVG, you can use something like this:

<svg width="19cm" height="26.5cm" viewBox="0 0 1900 2650" xmlns="http://www.w3.org/2000/svg" version="1.2"> 

Then you just make sure all your elements are in your 1900x2650 view.

Unfortunately, this is due to the "recreation" of your page in SVG, which is quite a nuisance. However, this seems to be necessary. HTML and CSS solutions cannot guarantee that content will not flow across multiple pages on which you planned to create one page.

0
source

All Articles