This a common problem and here is a good tutorial about this.
The problem would look like this:
When printing a web page, sometimes an element should not be printed on two pages. For example, we want a set of questions to be in the same page. At this time, we need set the page-breaking behavior.
CSS code for this is actually very easy:
.pagebreak{ page-break-before:always; } |
Is there any css code for browsers to print out background colors? No, there is no such css code, background images and colors are ignored for browsers. So don’t rely on background colors for printing.
To let browsers print background colors and images, you need to configure your browsers option.
This post uses Stack Overflow to illustrate how to make a good css layout. It looks like the following: Download link is http://programcreek.com/downloads/sof.rar