HTML and CSS Reference
In-Depth Information
figure 8-41
setting the page size with the @page rule
3. Save your changes to the file.
Printing Hypertext Links
The great appeal of the Web is the ability to quickly navigate from document to document
using hypertext links. This advantage is lost when a user views a printed version of a page.
Because hypertext links within the main content of the page are often underlined, you may
want to remove that underlining to make your printed version easier to read.
However, readers of the printed version might also want to know the URLs of those
links so that they can view those sites at a later date. You can use CSS to automatically
add the URL of each link to the printed version using the following style rule:
a:after {
content: “ (“ attr(href) “) “;
This style rule uses the after pseudo-element along with the content property and
the attr() function to append the text of the href attribute to each hyperlink. Using
this style rule, the hypertext link
Visit the <a href=””>Tr ee and Book</a> Web site.
would appear in the printed version of the document as follows:
Visit the Tree and Book ( W eb site.
You should be careful when using this technique with all of your hypertext links.
Appending the text of a long and complicated URL will make your text difficult to read and
will probably not help your users very much. Several JavaScript tools are available on the
Web to give you more options for how your URLs should be printed, including scripts that
automatically append all URLs as footnotes at the end of the printed document.
Working with Page Breaks
When a document is sent to a printer, the browser determines the location of the page
breaks unless that information is included as part of the print style. To specify a page
break that occurs either before or after a page element, you apply the style properties
page-break-before: type ;
page-break-after: type ;
where type has the following possible values:
always :
to always place a page break before or after the element
avoid :
to never place a page break
Search WWH ::

Custom Search