You are here: Reference > HTML > attributes > media (link, style)

media attribute (link, style)

Browser support:
Specifies 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.
JavaScript page for this attribute: media. You can find other example(s) there.

Possible values:

String that sets a comma-separated list of media types.
The list of the supported media types:
all
Default. For all media.
aural
Speech synthesizers.
braille
Braille tactile feedback devices.
embossed
Paged braille printers.
handheld
Handheld devices.
print
Printed pages and print preview.
projection
Projectors or print to transparencies.
screen
Color computer screens.
speech
Intended for speech synthesizers.
tty
Teletypes.
tv
Television-type devices.
Default: all.

Example HTML code 1:

This example illustrates the use of the media attribute:
<head>
    <style media="print">
        h1 { text-align: center }
    </style>
</head>
<body>
    <h1>This element will be centered in printed pages and print preview.</h1>
</body>
Did you find this example helpful? yes no

Supported by tags:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content