@page { size: A4 landscape; margin-left:10px; margin-right:10px; margin-top:37px; margin-bottom:20px; @top-center { content: element(header) }; @bottom-center { content: element(footer) } ; } .header { position: running(header); text-align:left; } .footer { position: running(footer); font-size: 90%; text-align:center; } .content{} #pagenumber:before { content: counter(page); } #pagecount:before { content: counter(pages); } html里的写法: <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Component Associations Report</title> <link href="css/pdf.css" rel="stylesheet" type="text/css" media="print" /> </head> <body> <div class="header" ><img src="img/argusLogo.GIF"/></div> <div class="footer"> Page <span id="pagenumber"/></div> </body> </html> 拓展阅读:http://blog.csdn.net/shanliangliuxing/article/details/6833471