我创建了一个带有标题图像的网页(style="background-repeat: repeat-x;")。我需要打印这一页。然后点击打印预览,我看到两页。第一页顶部位置包括标题图像,然后2页是相同的标题图像包括在内,但我只需要第一页与标题图像,2页不需要标题图像。请帮帮我
发布于 2009-11-26 17:12:14
不幸的是,这就是Firefox的功能,每个新的打印页面就像一个单独的网页。
我建议你使用“打印”特定的CSS,去掉正文背景,让区块标题只在打印时可见。
下面是一个例子:
<html>
<head>
<style type="text/css">
body {
background: url(topbg.jpg) repeat-x;
}
div#printheader { /* Do not display for other non-print media */
display: none;
}
@media print { /*CSS for print*/
body {
background: none;
}
div#printheader {
display: block;
}
}
</style>
<body>
<div id="printheader"><img src="topbg.jpg" /></div>
.
.
.
.
.
</body>
</html>https://stackoverflow.com/questions/1802377
复制相似问题