开发者

How to print header logo on print page

开发者 https://www.devze.com 2023-02-01 03:28 出处:网络
I want to print the header logo on print page开发者_JS百科 which is not present on screen displayed.

I want to print the header logo on print page开发者_JS百科 which is not present on screen displayed. Please suggest, How can I do this?

Thanks!


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.


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:

  • http://www.alistapart.com/articles/goingtoprint/
0

精彩评论

暂无评论...
验证码 换一张
取 消