how do I make an element in a webpage not be printed?
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.
精彩评论