Print CSS and page breaks

I want to insert a page break when users print my web page.

IE 7, Mozilla 3.0, Any Chrome

+4
source share
3 answers

You can use CSS page-break-before or page-break-after in the print stylesheet to achieve this.

For instance:

<style> @media print { table { page-break-after: always; } } </style> 
+8
source

I needed to do this only once, but in IE7 / IE8 this worked fine. However not sure about Chrome or Firefox.

 <div>This is before the page break.</div> <div style="page-break-after:always;"></div> <div>This is after the page break.</div> 
0
source

Although most Internet users prefer to read web pages on the Internet, some of your users may want to print the text of the article and then read it.

Using CSS, you can control the location of broken pages and go to the next page when printing. Just add the following CSS to your styles and then assign a page break class to each tag that you want to print on the next page.

 page-break { page-break-before: always; } 
0
source

Source: https://habr.com/ru/post/1335431/


All Articles