How to disable printing of pages _css/html

Source: Internet
Author: User
How to disable printing of pages _css/html

Solution Ideas:
To really prohibit printing pages is not possible, but if you can set the user to print to a blank, but also for the purpose of banning printing.
Specific steps:
code example:


Note: The CSS defined in @media print{} rule is only valid for pages that are printed.
Tip: In many forums when you print a post is a dedicated page to achieve, if you can skillfully use @media print{} rules, you do not have to do a separate page for printing.
Tips:
@media print{} rules can be used for code print as well as all and screen.
Rules like @media are shown in table 2.2.1.

Rule description
@import Specifies the imported external style sheet and target media. The rule must be first declared on the style sheet header
@charset used within an external style sheet file. Specifies the character set used by this style sheet.
@font-face to set OpenType fonts embedded in HTML documents (ie5+ support required)
@media specifying a style sheet rule for the specified media type (requires ie5.5+ support)


Special Tips
Run this example code, and then print the Web page, and the print results will not include "main document content."

Special Instructions

This example uses the @media rule to define the style that the page applies to when printing, which means that the defined CSS is applied to the printer, similar to the print media type:
All applies to all types of devices

Screen display for computer

The above is how to prohibit printing page _css/html content, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.