Home > Web Front-end > CSS Tutorial > Use the page-break-after attribute in CSS to implement forced paging printing of WEB pages

Use the page-break-after attribute in CSS to implement forced paging printing of WEB pages

黄舟
Release: 2017-07-08 09:56:07
Original
2297 people have browsed it

Although dedecms.com has introduced you to a lot of knowledge about CSSproperties, some very unpopular properties are still lacking. In B/S programs, CSS is relatively weak in controlling printing pages. For example, automatic paging has basically no practical use. We usually need to force the browser to paginate when needed. In this case, we can use the following style:

Sample code

 [www.dedecms.com]<style type="text/css">
  .w3cbbs { page-
break
-after:always;}
</style>
Copy after login

 auto: has no effect on page splitting.
Always: Force the page separator to appear after the element.
Avoid: Avoid page separators appearing after elements.
 left: Inserts a page break after the element until it reaches a blank left page margin.
 right: Inserts a page break after the element until it reaches a blank right margin.
 Inherit: Use the same attribute value as the parent element.

When web printing is paginated, you can insert the tag

Sample Code

 [www.dedecms.com]<p class="w3cbbs"></p>,
Copy after login

or

<p class="w3cbbs"></p>
Copy after login


where you need to paginate. !
But when using it, you may encounter that IE can paginate normally, but Firefox has no effect. After analysis, it was found that when using the page-break-after attribute in Firefox, it is not possible to put all the printed content in a table. In other words, Firefox cannot disconnect the table. Therefore, when using page-break-after to perform paging printing in Firefox, avoid placing the printed content in a table. The alternative method can be to place the content in a p.

The above is the detailed content of Use the page-break-after attribute in CSS to implement forced paging printing of WEB pages. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
web
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template