html - Couldn't insert a text into sub-selectors of @page selector -
i need write bunch of formatted text, uncomfortable (at least me) office apps, markdown + css. stuck problem couldn't set page counters. e.g. this answer tells have use sub-selector @bottom-right
of @page
paste number, like
@page { @bottom-right { content: counter(page) " of " counter(pages); } }
@page selector configures formatting 1 prints page. unfortunately example didn't work me. in fact, couldn't insert text using content:
function.
a minimal (non-) working example:
<!doctype html> <html> <head><title>test</title> <meta http-equiv='content-type' content='text/html; charset=utf-8' /> <style> h1 { counter-reset: subsection; page-break-after: always; } @page{ @top-left { content: "hello"; } } </style> </head> <body> <h1>section 1</h1> <h1>section 2</h1> <h1>section 3</h1> <h1>section 4</h1> <h1>section 5</h1> </body> </html>
here see 5 headers being shown 5 separate pages when ask browser print it. besides, accordingly @page
rule, should see somewhere in top-left corner of every page word «hello». you? tested in firefox , chrome, , no matter corner choose, never see text there.
i tried (although supposed unneeded @page) wrap @media print{…}
, changed nothing.
note: when testing, don't confused page counters browsers tends insert on own.
Comments
Post a Comment