Set the page-breaking behavior for an element

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;
}

However, to use this function we need to leave enough space for an element, otherwise, it won't work. This means that there is some space wasting. It's not hard to understand this, because we want an element stay together, but the current page doesn't have enough left, so it should be set to the next page.

Category >> CSS Design  
If you want someone to read your code, please put the code inside <pre><code> and </code></pre> tags. For example:
<pre><code> 
String foo = "bar";
</code></pre>