I have an input document of XML data that will resolve nicely into data cards that can be printed 2 to a page (or maybe 4 to a page, or 9 to a page, or something).
What’s the best way for me to style the data for them to be printed that way? For example, how can I say “Make this div extend 1/3 of the way down a printed page”?
HTML isn’t really intended for exact display in that way. Having said that…
If you know the paper size, you can perhaps be clever with the units in a print stylesheet (i.e. using
cmrather thanpxorem). You may even be able to use percentages and not worry about the paper size too much, but I haven’t tested this. It would also depend on the content, its layout, and how different the paper sizes might be.An example of using percentages (to force a
<div>to be 1/3 the page height) would be specifyingheight: 33%in the CSS.It is also possible to force page breaks in CSS, by specifying
page-break-after: always(orpage-break-before: alwaysif that is more convenient).