I have some pages that need to be printer-friendly. On these pages, having the full href on the printed page is not a significant benefit to the user and it's often redundant and ugly ("whoever@unl.edu (mailto:whoever@unl.edu)"). The printed hrefs are breaking my layout because they're longer than the text of the link on the screen, with no spaces they don't wrap, and their containers often expand to accommodate them.
So far the best I've come up with is to use CSS and do something like this:
- Code: Select all
.url_screen { display:inline; }
.url_print { display:none; }
@media print {
.url_screen { display:none; }
.url_print { display:inline; }
}
<a class="url_screen" href="http://psycweb.unl.edu/psypage/dynamic.asp?dir=grad&page=overview.htm">Psychology</a>
<span class="url_print">Psychology</span>
That seems to work, printing as "Psychology" rather than "Psychology (http://psycweb.unl.edu/psypage/dynamic. ... erview.htm)", but there's got to be a better way.

