Css: how to set a css style sheet for the page to be printed

Source: Internet
Author: User
For a page, although you can see beautiful styles in a browser, if you do not set a print style for the page, the printed page is very simple, the effect is not the same as that shown in the browser. Because the css in the page is only applied to the browser and not printing. So how do I set the Print Style? Method 1: Use link to introduce an external style sheet.



  

The media attribute is set to print, indicating that the style is applied to printing.

Ii. import a style sheet.

The style introduced in the above Code can be used to print the style.

3. The page style and print style are in the same file.

@ Media print {h1 {color: black;} h2 {color: gray ;}} p {color: red}

The preceding three methods are used to set the Print Style.

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.