Learn HTML Code Tutorial Reference Guide

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">




 

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   Privacy Policy   |   About
Copyright ©1997-2002 Idocs and ©2002-2014 HTML Code Tutorial