media property (styleSheet, link, style)
Specifies or returns the media types for style definition.
Media types are the target devices for style properties. To set a media type for a style, you can use the @media rule as well.
You can find the related objects in the Supported by objects section below.
This property is read/write.
|HTML page for this property: media|
String that sets or retrieves a comma-separated list of media types.
The list of the supported media types:
|Default. For all media.|
|Braille tactile feedback devices.|
|Paged braille printers.|
|Printed pages and print preview.|
|Projectors or print to transparencies.|
|Color computer screens.|
|Intended for speech synthesizers.|
Example HTML code 1:
This example illustrates the use of the media attribute:
Example HTML code 2:
This example illustrates the use of the media property:
Example HTML code 3:
This example uses the styleSheets collection to access the media. The media property of the styleSheet object works differently in Internet Explorer before version 9, than in other browsers. Fortunately, the type of the media property in Internet Explorer before version 9 differs from the type of the media property in other browsers. See the page for the media property for details.
User Contributed Comments