.A4{
page-break-before: auto; page-break-after: always; }
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>分页测试</title> <style type="text/css"> <!-- .A4 { page-break-before: auto; page-break-after: always; } --> </style> </head> <body> <div class="A4">第一页</div> <div class="A4">第二页</div> </body> </html>
打印的方法:window.print();