<style type="text/css" media="print">
@page /* 实现代码 */
{
size: auto; /* auto is the initial value */
margin: 0mm; /* this affects the margin in the printer settings */
}
body /* 设置打印范围的边距,不设置打印内容会顶着最上边 */
{
background-color:#FFFFFF;
border: solid 0px black ;
margin: 50px; /* this affects the margin on the content before sending to printer */
}
</style>
head中加入以上代码,主流浏览器均可以实现。
参考http://stackoverflow.com/questions/1960939/disabling-browser-print-options-headers-footers-margins-from-page