CSS tips: Use CSS to force pages on Web pages for printing!

Source: Internet
Author: User

B/SProgramIn, the control of the printed page is relatively weak, for example: Automatic paging, there is basically no practical use. We usually need to force browser paging as needed. In this case, we can use the following style:
<Style type = "text/CSS">
. Pagebreak {page-break-after:Always;}
</Style>
Auto: Does not affect page segmentation.

Always: Force a page delimiter to appear after an element.

Avoid: Avoid page delimiters after an element.

Left: Insert a page delimiter after an element until it reaches the left edge of a blank page.

Right: Insert a page delimiter after an element until it reaches the right side of a blank page.

Inherit: Use the same attribute value as the parent element.
When printing pages on the web, you can insert the tag <P class = "pagebreak"> </P> where the page needs to be paged,
Or <Div class = "pagebreak"> </div>!
However, in use, the IE page may be displayed normally, but Firefox does not. After analysis, it is found that when the page-break-after attribute is used in Firefox, it cannot be put in a table like all the printed content. That is to say, Firefox cannot disconnect the table. Therefore, in Firefox, page-break-after is used for paging printing. Avoid placing the printed content in a table. Instead, you can place the content in a div.

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.