Forum How do I...?

Vertically align a page

jared
I'm trying to vertically align a page by using this code:
@page {vertical-align: middle;}

However, it doesn't seem to work. Any suggestions?
mikeday
It is not currently possible to vertically align page content in this way, although there are various tricks with table cells and other markup that could perhaps simulate this effect in some circumstances.

The simplest solution might be to just place a top margin on your content, moving down the page and roughly centering it on the page. This should be adequate if you know in advance that the content will not be too tall and will fit on the page.

The idea of applying the vertical-align property directly to the page itself does look compelling however; perhaps it would be worth investigating this for future inclusion into Prince if it fits in comfortably with the CSS specification.
mikeday
Also, take a look at the example of using absolute positioning to vertically center a block on the page in this forum post.