How to stop printing the page

Solution: 
To prohibit the printed page is really impossible, but if you can set up to allow users to print a blank, can be considered to achieve the purpose of the prohibition of printing. 
Specific steps: 
Code Example: 

<HTML> 
<head> <title> unprintable pages </ title> 
<style> 
@media Print { 
body {the display: none} 

</ style> 
</ head> 
<body> 
document is SUMMARY 
</ body> 
</ head> 

Note: @media print {} page when CSS rules defined only print effect. 
Tip: In many forums are used to implement a special page in the print post, if you can skillfully use @media print {} rule, would not have done with a single page of print. 
Tip: 
@media print {} rule can be used to print the code and all the well screen. 
Similar @media rules in Table 2.2. 1 shown in FIG.

Rule Description 
@import external style sheet and specify the target media import. The rules must first be declared in the stylesheet head 
@charset use in an external style sheet file. Specify the character set used in the style sheet. 
@ font-face setting OpenType fonts embedded in the HTML document (to be IE5 + support) 
@media rule specifies the style sheet is used to specify the type of media (need IE5.5 + support) 


Special Note 
run this example code, and then print the page, print the results will not include "the main contents of the document." 

Special Note

this example, the main use of the @media rules to define the page style for use when printing, print meaning as defined in the CSS used in printers, there is a similar type of print media: 
All applies to all types of devices 
screen for the computer display 

Guess you like

Origin www.cnblogs.com/cangqinglang/p/11819823.html