Idocs Guide to HTML

Attribute for <LINK ...>
MEDIA = SCREEN | PRINT | PROJECTION | AURAL | BRAILLE | ALL | other media

MEDIA indicates which type of media the link applies to. The default is ALL, which means that the link applies to any media.

MEDIA is commonly used to set the appearance of the page for when it is printed. Because links in the page are no use when the page is printed you can use MEDIA and styles to make the printed links look like normal text.

First, create a file for the print-only styles. Let's call it printonly.css. Type the following code into the file:

A{text-decoration:none}
A:link{color:black}
A:visited{color:black}

Now, in your web page, in the <HEAD> section, put this <LINK ...> tag:

<LINK REL=STYLESHEET HREF="printonly.css" MEDIA=PRINT>

This gives us a web page like this.

MEDIA can be set to a list of values. Separate each media type with a comma. Be sure to put quotes around the list. So, for example, the following code indicates that the styles apply to print or to projection:

<LINK REL=STYLESHEET HREF="printonly.css" MEDIA="PRINT,PROJECTION">

Copyright 1997-2002 Idocs Inc. Content in this guide is offered freely to the public under the terms of the Open Content License and the Open Publication License. Contents may be redistributed or republished freely under these terms so long as credit to the original creator and contributors is maintained.