1

我创建了一个带有标题图像的网页(style="background-repeat: repeat-x;")。我需要打印此页。然后打印预览单击,我看到 2 页。第一页顶部位置包括标题图像,然后 2 页包含相同的标题图像,但我只需要带有标题图像的第一页,2 页不需要标题图像。请帮我

4

1 回答 1

0

Unfortunately, that's how Firefox function, each new print page is like an individual web page.

I would recommend you use a "print" specific CSS by removing the body background and having a block header visible only in print.

Here's an example:

<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>
于 2009-11-26T09:12:14.450 回答