如何在打印页面上打印页眉徽标
我想在打印页面上打印标题徽标,该徽标不存在于屏幕上显示的位置。 请建议,我该怎么做?
谢谢!
I want to print the header logo on print page which is not present on screen displayed.
Please suggest, How can I do this?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
假设我们正在讨论 HTML/CSS,您可以为某些媒体类型使用自定义 CSS,例如:
或内联:
这应该可以让您完成您所需要的。
Assuming we're talking about HTML/CSS, you can have custom CSS for some media types, like:
or, inline:
This should allow you to accomplish what you need.
您将使用打印样式表。
在普通样式表中,您可以将徽标设置为
display: none;
,在打印样式表中,您可以将其设置为display: block;
。这会将其隐藏在屏幕上并在打印时显示。
注意:如果您在主站点设计中使用了
并将背景设置为徽标,则此操作将不起作用。浏览器不会打印背景(以节省墨水),因此背景不可见。您需要添加适当的
标记并应用上述方法。
查看此内容,了解打印样式表的相当明确的介绍:
You would use a print stylesheet.
In your normal stylesheet you would set the logo to
display: none;
and in the print stylesheet you would set it todisplay: block;
.This would hide it on screen and display it at print time.
Note: That if you have used a
<div>
with the background set to your logo in the main site design this wont work. Browsers dont print the backgrounds (to save ink) so it wouldnt be visible. You would need to add in a proper<img>
tag and apply the method mentioned above.Check this out for a pretty much definitive introduction to print stylesheets: