打印设置强制换页
插入这行就换页了
<div style="page-break-after: always;"></div>
打印时展示内容,不打印时隐藏
我是放全局的才有效。你们随意
media print 打印时的样式
media screen 正常的情况下
<style type="text/css" media="print">
.showPrint{
display:block;
}
</style>
<style type="text/css" media="screen">
.showPrint{
display:none;
}
</style>
去除默认打印的页眉页脚
<style type="text/css" media="print">
@page{
size: auto;
margin: 0 auto;
margin-top:10px;
}
</style>
自定义页眉页脚
<style type="text/css" media="print">
div.divFooter {
width:100%;
position:fixed;
bottom:0;
text-align: center;
border-top: 1px solid #eeeeee;
padding:10px 0;
color:#eeeeee;
}
div.divHeader {
width:100%;
position:fixed;
top:0;
text-align:center;
border-bottom: 1px solid #eeeeee;
padding:10px 0;
color:#eeeeee;
}
</style>
<style type="text/css" media="screen">
div.divFooter {
display:none;
}
div.divHeader {
display:none;
}
</style>
<div class="divHeader">页眉</div>
<div class="divFooter">页脚</div>
打印时图片最大限度撑满不出区域
<img style="width:100%;height:100%;"></img>
记录一下。也看了很多其他人的,就不列了,麻烦得很。