CSS打印控制分页及隐藏页面部分区域.

<html>
<head>
<title>看看</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<!--media=print 这个属性可以在打印时有效-->
<style type="text/css" media="print">
.Noprint{display:none;}
.Print{display:block;}
.PageNext{page-break-after: always;}
</style>

<style type="text/css" media="screen">
.hidden2{
    display:none;
}
</style>
<style type="text/css">
.tdp
{
    border-bottom: 1 solid #000000;
    border-left: 1 solid #000000;
    border-right: 0 solid #ffffff;
    border-top: 0 solid #ffffff;
}
.tabp
{
    border-color: #000000 #000000 #000000 #000000;
    border-style: solid;
    border-top-width: 2px;
    border-right-width: 2px;
    border-bottom-width: 1px;
    border-left-width: 1px;
}
}
</style>

</head>

<body >
<center>
表头
</center>

<table width="90%" border="0" align="center" cellpadding="2" cellspacing="0" class="tabp">
<tr>
<td colspan="3" class="tdp">第1页</td>
</tr>
<tr>
<td width="29%" class="tdp">&nbsp;</td>
<td width="28%" class="tdp">&nbsp;</td>
<td width="43%" class="tdp">&nbsp;</td>
</tr>
<tr>
<td colspan="3" class="tdp">&nbsp;</td>
</tr>
<tr>
<td colspan="3" class="tdp"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" class="tdp"><p>这样的报表</p>
<p>对一般的要求就够了。</p></td>
<td>&nbsp;</td>
</tr>
</table></td>
</tr>
</table>
<hr align="center" width="90%" size="1" noshade class="NOPRINT" />
<!--分页-->
<div class="PageNext"></div>
<center class="Print hidden2">
表头
</center>
<table width="90%" border="0" align="center" cellpadding="2" cellspacing="0" class="tabp">
<tr>
<td class="tdp">第2页</td>
</tr>
<tr>
<td class="tdp">看到分页了吧</td>
</tr>
<tr>
<td class="tdp">&nbsp;</td>
</tr>
<tr>
<td class="tdp">&nbsp;</td>
</tr>
<tr>
<td class="tdp"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" class="tdp"><p>这样的报表</p>
<p>对一般的要求就够了。</p></td>
<td>&nbsp;</td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>

posted on 2009-03-30 11:28  雨季  阅读(1241)  评论(0编辑  收藏  举报