Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All


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

@media sMediaType { sRules }


String that specifies one of the following media types:


Output is intended for all devices.


Output is intended for printed material and for documents viewed in Print Preview mode.


Output is intended for computer screens.


String that specifies one or more rules in a style sheet.

The rule has no default value.

In the following example, the @media rule is used to specify the font-size property 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;}

Community Additions

© 2015 Microsoft