如何在打印页面上打印页眉徽标

发布于 2024-10-09 09:59:41 字数 61 浏览 0 评论 0原文

我想在打印页面上打印标题徽标,该徽标不存在于屏幕上显示的位置。 请建议,我该怎么做?

谢谢!

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

南七夏 2024-10-16 09:59:41

假设我们正在讨论 HTML/CSS,您可以为某些媒体类型使用自定义 CSS,例如:

<link rel="stylesheet" type="text/css" href="sample.css" media="print" />   

或内联:

@media print
  {
  p.test {font-family:times,serif;font-size:10px;}
  }
@media screen
  {
  p.test {font-family:verdana,sans-serif;font-size:14px;}
  }

这应该可以让您完成您所需要的。

Assuming we're talking about HTML/CSS, you can have custom CSS for some media types, like:

<link rel="stylesheet" type="text/css" href="sample.css" media="print" />   

or, inline:

@media print
  {
  p.test {font-family:times,serif;font-size:10px;}
  }
@media screen
  {
  p.test {font-family:verdana,sans-serif;font-size:14px;}
  }

This should allow you to accomplish what you need.

伊面 2024-10-16 09:59:41

您将使用打印样式表。

在普通样式表中,您可以将徽标设置为 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 to display: 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:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文