Controlling Page Breaks
Browsers can show very long pages in a single window thanks to the scroll bar. When
To control page breaks before elements:
In the style rule, type
is one of
(so that page breaks always occur before/after the selected elements),
(so that page breaks only occur before/after the selected elements when
To keep elements from being divided between two pages:
In the style rule, type page-break-inside: avoid .
Figure 14.5. I don't want paragraphs to be divided between pages so I use page-break-inside:avoid . So that each second level header starts on its own page, I add page-break-before:always to the h2 tags.
Figure 14.6. By
Printing Link URLs
Since link URLs are not shown on a Web page, they are not usually printed with the page either. The CSS content property can reveal those URLs in the printed edition of your page. Too bad Internet Explorer (up to and including version 7) still doesn't get it.
To print link URLs:
Figure 14.7. First I remove the typical coloring and underlining that on-screen links get. Then I take the HRef attribute of the selected element and add parentheses and finally italic formatting to it.
Figure 14.8. The value of the link's
attribute, which is the URL that we want, is printed after the "click-me" part of the link (in this case, my