How to print page breaks with CSS settings in Web pages

Source: Internet
Author: User

Word Press Ctrl + Enter to create a page break, easy to print, in fact, the page can also, with CSS page-break-after:always;

<p> 1th Page </p>
<div style= "page-break-after:always;" ></div>
<p> 2nd Page </p>
<div style= "page-break-after:always;" ></div>
<p> 3rd page </p>

Page-break-after:always is supported by any browser, but the other property values of Page-break-after are left, right, inherit, avoid and there are always browsers that do not support it. Page-break-after applies to non-floating block-level elements with a position value of relative or static. Page-break-after does not work when the display of an element or parent element is none.

The above applies page-break-after to a blank div, making it look more like a page break, in fact Page-break-after applied to the last label on the current page, such as the following code:

<p> 1th Page </p>
<p style= "page-break-after:always;" > 1th page </p>
<p> 2nd Page </p>
<p style= "page-break-after:always;" > 2nd page </p>
<p> 3rd page </p>
<p> 3rd page </p>

The elements of the page-break-after must be visible when printing, otherwise it will not work.

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.