Use CSS to control the printing page format

Source: Internet
Author: User

Due to customer requirements, the printed button must be removed during printing. At this time, the style sheet that controls printing is used.

<Link rel = "stylesheet" type = "text/css" media = "print" href?#print.css "/>

Because XHTML and CSS are separated, we can freely write the content and representation that needs to be printed in print.css. This also requires us to take into account the requirements of the print display effect when writing xhtml, with good extension labels and structure nesting, so that we can easily use the display: none sets the content to not display. Then it's time to write the print.css content. You can write the page you want to print like setting the word.

Later I thought about it. In fact, writing a css separately increases the number of requests, and I thought of the role of @ media print {}. The Code is as follows:

@ Media print {
. Printdesc
{
Right: 0;
Width: 685px;
Height: 69px;
Background-color: # FFFFFF;
Float: left;
Overflow: auto;
Border: 0px;
}
. Text {
Float: right;
Width: 688px;
Margin-top: 20px;
}
. Printlink {
Height: 0px;
Display: none;
Width: 0px;
Z-index:-10;

}
. Printlink {
Display: none;
}
}

Later I thought that iframe can be used to print a part of the page. Currently, the partial content of the page is basically processed using iframe ~ Record

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.