开发者

how do I make an element in a webpage not be printed?

开发者 https://www.devze.com 2023-01-24 07:00 出处:网络
I\'ve made a simple \"print version\" for the entries in our company website. However, I am required to add a button/link for going back to the website, since, alleg开发者_运维知识库edly, many of our

I've made a simple "print version" for the entries in our company website. However, I am required to add a button/link for going back to the website, since, alleg开发者_运维知识库edly, many of our customers wouldn't think to use the back button (and, indeed, there might be some truth in that - as they kept emailing, asking for a pricelist for one entry, which was actually clearly linked to, with large underlined letters, in the description)

Okay, that's all fine and dandy - however, can I do anything to make that element not to be printed?


Write a css file for printout page, and just write display:none for the elements you want to hide.

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

Yes, media = "print"


here is a simple guide to print stylesheets.


In CSS:

@media print
{
    .dontPrintThis, .neitherThis { display: none; }
    .printThisBigger { font-size: 120%; }
    /* ... */
}


You can have different stylesheets for different "media" like print, projector, screen...

See list of media types.

This is a nice (but old) article on print stylesheets.

0

精彩评论

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