Sets the media types for a set of rules in a STYLESHEET object.
Syntax
@media sMediaType { sRules }
Possible values
sMediaType
String that specifies one of the following media types:
all | Output is intended for all devices. |
Output is intended for printed material and for documents viewed in Print Preview mode. | |
screen | Output is intended for computer screens. |
sRules
String that specifies one or more rules in a style sheet.
Remarks
The rule has no default value.
Example
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;} } |
Standards information
This rule is defined in Cascading Style Sheets (CSS), Level 2 (CSS2).