Page Numbers in print in CSS

Hi all,

I have done some searching on the net for this,but to no avail.

Does anyone know how to generate page numbers when printing documents in CSS?

Thanks

The only way I can think of is to wrap each page in an element (a div with a class) and use generated counters.

Something along these lines,

body {counter-reset:page}
div.page {page-break-before:always; counter-increment:page}
div.page:after {display:block; text-align:right; content:counter(page)}
div.first.page {page-break-before:avoid}

It won’t work in IE, of course.

Normally, browsers print the page numbers though, don’t they? At least Opera does.

The header and footer info printed on each page are under the control of the browser. All the browsers I have tried printing from have page numbering on by default.