Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
HTML and CSS
CSS Reference
At-rules
 @media Rule

  Switch on low bandwidth view
@media Rule

Sets the media types for a set of rules in a styleSheet object.

Syntax

HTML@media sMediaType { sRules }
ScriptingN/A

Possible Values

sMediaType String that specifies one of the following media types:
screenOutput is intended for computer screens.
printOutput is intended for printed material and for documents viewed in Print Preview mode.
allOutput is intended for all devices.
sRulesString that specifies one or more rules in a styleSheet object.

Remarks

The rule has no default value.

Expressions can be used in place of the preceding value(s), as of Microsoft Internet Explorer 5. For more information, see About Dynamic Properties.

Example

In the following example, the @media rule is used to specify the font-size attribute of the body element for two media types.

// For computer screens, the font size is 12pt.
@media screen {
   BODY {font-size:12pt;}
}
// When printed, the font size is 8pt.
@media print {
   BODY {font-size:8pt;}
}

Standards Information

This rule is defined in Cascading Style Sheets (CSS), Level 2 (CSS2) World Wide Web link.

See Also

media
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker