HTML/CSS Service

CSS media types rules

Category: CSS, CSS 2 Tutorial, CSS3 Tutorial    |    485 views   |   

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

Syntax

HTML
@media sMediaType { sRules }

Scripting
N/A

Possible Values

sMediaType String that specifies one of the following media types: screen    Output is intended for computer screens.     print    Output is intended for printed material and for documents viewed in Print Preview mode.     all    Output is intended for all devices.
sRules    String 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;}
}

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • digg
  • del.icio.us
  • Stumble it
  • Furl
  • Reddit
  • BlinkList
  • Simpy
  • YahooMyWeb
  • Spurl

Share/Save/Bookmark

1 Star2 Stars

Tags: ,

0 responses so far!

Leave a Comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word