调用谷歌浏览器自带的打印的时候,我现在只需要页码就行了,其余的页眉、页脚可以删除吗?
解决了吗?我也遇到同样的问题了
可以点掉 或者使用局部打印(获取一个元素 里的内容打印)
下面这个可以试试
关键点是@page {
size: auto;
margin: 0mm;
} 这个去掉了好像就不行了
<!DOCTYPE html>
<html>
<head>
<title>打印</title>
<meta charset="utf-8">
<style>
.printBox {
border: 1px solid blue;
}
</style>
<!-- 打印的样式-->
<style media="print">
@page {
size: auto;
margin: 0mm;
}
</style>
</head>
<body>
<div class="printBox">
this is content!!!<br>
点击按钮打印
</div>
<button onclick='print_page()'>打印</button>
</body>
<script type="text/javascript">
function print_page() {
window.print();
}
</script>
</html>
楼主解决了吗?我也有同样的问题