Home > Article > Web Front-end > Use the page-break-after attribute in CSS to implement forced paging printing of WEB pages
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>
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>,
or
<p class="w3cbbs"></p>
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!