CSS media queries

  • Revision slug: CSS/Media_queries
  • Revision title: CSS media queries
  • Revision id: 362893
  • Created:
  • Creator: FredB
  • Is current revision? No
  • Comment Updated link structure

Revision Content

A media query consists of a media type and at least one expression that limits the style sheets' scope by using media features, such as width, height, and color. Added in CSS3, media queries let the presentation of content be tailored to a specific range of output devices without having to change the content itself.

Syntax

Media queries consist of a media type and can, as of the CSS3 specification, contain one or more expressions, expressed as media features, which resolve to either true or false.  The result of the query is true if the media type specified in the media query matches the type of device the document is being displayed on and all expressions in the media query are true.

When a media query is true, the corresponding style sheet or style rules are applied, following the normal cascading rules. Style sheets with media queries attached to their <link> tags will still download even if their media queries would return false (they will not apply, however).

Unless using the not nor only operators, the media type is optional and the all type will be implied.

Logical operators

You can compose complex media queries using logical operators, including not, and, and only. The and operator is used for combining multiple media features together into a single media query, requiring each chained feature to return true in order for the query to be true. The not operator is used to negate an entire media query. The only operator is used to apply a style only if the entire query matches, useful for preventing older browsers from applying selected styles. Both the not and the only operators require a media type in order to be evaluated, all is not implied.

In addition, you can combine multiple media queries in a comma-separated list; if any of the media queries in the list is true, the entire media statement returns true. This is equilivant to an or operator.

and

The and keyword is used for combining multiple media features together, as well as combining media features with media types. A basic media query, a single media feature with the implied all media type, could look like this:

@media (min-width: 700px) { ... }

If, however, you wanted this to apply only if the display is in landscape, you could use an and operator to chain the media features together.

@media (min-width: 700px) and (orientation: landscape) { ... }

Now the above media query will only return true if the viewport is 700px wide or wider and the display is in landscape. If, however, you only wanted this to apply if the display in question was of the media type TV, you could chain these features with a media type using an and operator.

@media tv and (min-width: 700px) and (orientation: landscape) { ... }

Now, the above media query will only apply if the media type is TV, the viewport is 700px wide or wider, and the display is in landscape.

comma-separated lists

Comma-separated lists behave like the logical opeartor or when used in media queries. When using a comma-separated list of media queries, if any of the media queries returns true, the styles or style sheets get applied. Each media query in a comma-separated list is treated as an individual query, and any operator applied to one media query does not affect the others. This means the comma-separated media queries can target different media features, types, and states.

For instance, if you wanted to apply a set of styles if the viewing device either had a minimum width of 700px or was a handheld in landscape, you could write the following:

@media (min-width: 700px), handheld and (orientation: landscape) { ... }

Above, if I were on a screen device with a viewport width of 800px, the media statement would return true because the first part, interperated as @media all and (min-width: 700px) would apply to my device and therefore return true, despite the fact that my screen device would fail the handheld media type check in the second media query. Likewise, if I were on a handheld device held in landscape with a viewport width of 500px, while the first media query would fail due to the viewport width, the second media query would succeed and thus the media statement would return true.

not

The not keyword applies to the whole media query and returns true if the media query would otherwise return false (such as monochrome on a color display or a screen width of 600px with a min-width: 700px feature query). A not will only negate the media query it is applied to and not to every media query if present in a comma-separated list of media queries. The not keyword cannot be used to negate an individual feature query, only an entire media query. For example, the not is evaluated last in the following query:

@media not all and (monochrome) { ... }

This means that the query is evaluated like this:

@media not (all and (monochrome)) { ... }

... rather than like this:

@media (not all) and (monochrome) { ... }

As another example, look at the following media query:

@media not screen and (color), print and (color)

It is evaluated like this:

@media (not (screen and (color))), print and (color)

only

The only keyword prevents older browsers that do not support media queries with media features from applying the given styles:

<link rel="stylesheet" media="only screen and (color)" href="example.css" />

Pseudo-BNF (for those of you that like that kind of thing)

media_query_list: <media_query> [, <media_query> ]*
media_query: [[only | not]? <media_type> [ and <expression> ]*]
  | <expression> [ and <expression> ]*
expression: ( <media_feature> [: <value>]? )
media_type: all | aural | braille | handheld | print |
  projection | screen | tty | tv | embossed
media_feature: width | min-width | max-width
  | height | min-height | max-height
  | device-width | min-device-width | max-device-width
  | device-height | min-device-height | max-device-height
  | aspect-ratio | min-aspect-ratio | max-aspect-ratio
  | device-aspect-ratio | min-device-aspect-ratio | max-device-aspect-ratio
  | color | min-color | max-color
  | color-index | min-color-index | max-color-index
  | monochrome | min-monochrome | max-monochrome
  | resolution | min-resolution | max-resolution
  | scan | grid

Media queries are case insensitive.  Media queries involving unknown media types are always false.

Note: Parentheses are required around expressions; failing to use them is an error.

Media features

Most media features can be prefixed with "min-" or "max-" to express "greater or equal to" or "less than or equal to" constraints.  This avoids using the "<" and ">" symbols, which would conflict with HTML and XML.  If you use a media feature without specifying a value, the expression resolves to true if the feature's value is non-zero.

Note: If a media feature doesn't apply to the device on which the browser is running, expressions involving that media feature are always false.  For example, querying the aspect ratio of an aural device always results in false.

color

Value: {{ Xref_csscolorvalue() }}
Media: {{ Xref_cssvisual() }}
Accepts min/max prefixes: yes

Indicates the number of bits per color component of the output device.  If the device is not a color device, this value is zero.

Note: If the color components have different numbers of bits per color component, the smallest number is used.  For example, if a display uses 5 bits for blue and red and 6 bits for green, then the device is considered to use 5 bits per color component.  If the device uses indexed colors, the minimum number of bits per color component in the color table is used.

Examples

To apply a style sheet to all color devices:

@media all and (color) { ... }

To apply a style sheet to devices with at least 4 bits per color component:

@media all and (min-color: 4) { ... }

color-index

Value: {{ xref_cssinteger() }}
Media: {{ Xref_cssvisual() }}
Accepts min/max prefixes: yes

Indicates the number of entries in the color look-up table for the output device.

Examples

To indicate that a style sheet should apply to all devices using indexed color, you can do:

@media all and (color-index) { ... }

To apply a style sheet to indexed color devices with at least 256 colors:

<link rel="stylesheet" media="all and (min-color-index: 256)" href="http://foo.bar.com/stylesheet.css" />

aspect-ratio

Value: {{ xref_cssratio() }}
Media: {{ Xref_cssvisual() }}, {{ Xref_csstactile() }}
Accepts min/max prefixes: yes

Describes the aspect ratio of the targeted display area of the output device.  This value consists of two positive integers separated by a slash ("/") character.  This represents the ratio of horizontal pixels (first term) to vertical pixels (second term).

Example

The following selects a special style sheet to use for when the display area is at least as wide as it is high.

@media screen and (min-aspect-ratio: 1/1) { ... }

This selects the style when the aspect ratio is either 1:1 or greater. In other words, these styles will only be applied when the viewing area is square or landscape.

device-aspect-ratio

Value: {{ xref_cssratio() }}
Media: {{ Xref_cssvisual() }}, {{ Xref_csstactile() }}
Accepts min/max prefixes: yes

Describes the aspect ratio of the output device.  This value consists of two positive integers separated by a slash ("/") character.  This represents the ratio of horizontal pixels (first term) to vertical pixels (second term).

Example

The following selects a special style sheet to use for widescreen displays.

@media screen and (device-aspect-ratio: 16/9), screen and (device-aspect-ratio: 16/10) { ... }

This selects the style when the aspect ratio is either 16:9 or 16:10.

device-height

Value: {{ Xref_csslength() }}
Media: {{ Xref_cssvisual() }}, {{ Xref_csstactile() }}
Accepts min/max prefixes: yes

Describes the height of the output device (meaning the entire screen or page, rather than just the rendering area, such as the document window).

Example

To apply a style sheet to a document when displayed on a screen that is less than 800 pixels wide, you can use this:

<link rel="stylesheet" media="screen and (max-device-width: 799px)" />

device-width

Value: {{ Xref_csslength() }}
Media: {{ Xref_cssvisual() }}, {{ Xref_csstactile() }}
Accepts min/max prefixes: yes

Describes the width of the output device (meaning the entire screen or page, rather than just the rendering area, such as the document window).

grid

Value: {{ xref_cssinteger() }}
Media: all
Accepts min/max prefixes: no

Determines whether the output device is a grid device or a bitmap device.  If the device is grid-based (such as a TTY terminal or a phone display with only one font), the value is 1.  Otherwise it is zero.

Example

To apply a style to handheld devices with a 15-character or narrower display:

@media handheld and (grid) and (max-width: 15em) { ... }
Note: The "em" unit has a special meaning for grid devices; since the exact width of an "em" can't be determined, 1em is assumed to be the width of one grid cell horizontally, and the height of one cell vertically.

height

Value: {{ Xref_csslength() }}
Media: {{ Xref_cssvisual() }}, {{ Xref_csstactile() }}
Accepts min/max prefixes: yes

The height media feature describes the height of the output device's rendering surface (such as the height of the viewport or of the page box on a printer).

Note: As the user resizes the window, Firefox switches style sheets as appropriate based on media queries using the width and height media features.

monochrome

Value: {{ xref_cssinteger() }}
Media: {{ Xref_cssvisual() }}
Accepts min/max prefixes: yes

Indicates the number of bits per pixel on a monochrome (greyscale) device.  If the device isn't monochrome, the device's value is 0.

Examples

To apply a style sheet to all monochrome devices:

@media all and (monochrome) { ... }

To apply a style sheet to monochrome devices with at least 8 bits per pixel:

@media all and (min-monochrome: 8) { ... }

orientation

Value: landscape | portrait
Media: {{ Xref_cssvisual() }}
Accepts min/max prefixes: no

Indicates whether the device is in landscape (the display is wider than it is tall) or portrait (the display is taller than it is wide) mode.

Example

To apply a style sheet only in portrait orientation:

@media all and (orientation: portrait) { ... }

resolution

Value: {{ Xref_cssresolution() }}
Media: {{ Xref_cssbitmap() }}
Accepts min/max prefixes: yes

Indicates the resolution (pixel density) of the output device.  The resolution may be specified in either dots per inch (dpi) or dots per centimeter (dpcm).

Example

To apply a style sheet to devices with at least 300 dots per inch of resolution:

@media print and (min-resolution: 300dpi) { ... }

scan

Value: progressiveinterlace
Media: {{ Xref_csstv() }}
Accepts min/max prefixes: no

Describes the scanning process of television output devices.

Example

To apply a style sheet only to progressive scanning televisions:

@media tv and (scan: progressive) { ... }

width

Value: {{ Xref_csslength() }}
Media: {{ Xref_cssvisual() }}, {{ Xref_csstactile() }}
Accepts min/max prefixes: yes

The width media feature describes the width of the rendering surface of the output device (such as the width of the document window, or the width of the page box on a printer).

Note: As the user resizes the window, Firefox switches style sheets as appropriate based on media queries using the width and height media features.

Examples

If you want to specify a style sheet for handheld devices, or screen devices with a width greater than 20em, you can use this query:

@media handheld and (min-width: 20em), screen and (min-width: 20em) { ... }

This media query specifies a style sheet that applies to printed media wider than 8.5 inches:

<link rel="stylesheet" media="print and (min-width: 8.5in)"
    href="http://foo.com/mystyle.css" />

This query specifies a style sheet that is usable when the viewport is between 500 and 800 pixels wide:

@media screen and (min-width: 500px) and (max-width: 800px) { ... }

Mozilla-specific media features

Mozilla offers several Gecko-specific media features. Some of these may be proposed as official media features.

{{ h2_gecko_minversion("-moz-images-in-menus", "1.9.2") }}

Value: {{ xref_cssinteger() }}
Media: {{ Xref_cssvisual() }}
Accepts min/max prefixes: no

If the device allows images to appear in menus, this is 1; otherwise, the value is 0. This corresponds to the {{ cssxref(":-moz-system-metric(images-in-menus)") }} CSS pseudo-class.

{{ h2_gecko_minversion("-moz-mac-graphite-theme", "1.9.2") }}

Value: {{ xref_cssinteger() }}
Media: {{ Xref_cssvisual() }}
Accepts min/max prefixes: no

If the user has configured their device to use the "Graphite" appearance on Mac OS X, this is 1. If the user is using the standard blue appearance, or is not on Mac OS X, this is 0.

This corresponds to the {{ cssxref(":-moz-system-metric(mac-graphite-theme)") }} CSS pseudo-class.

{{ h2_gecko_minversion("-moz-maemo-classic", "1.9.2") }}

Value: {{ xref_cssinteger() }}
Media: {{ Xref_cssvisual() }}
Accepts min/max prefixes: no

If the user is using Maemo with the original theme, this is 1; if it's using the newer Fremantle theme, this is 0.

This corresponds to the {{ cssxref(":-moz-system-metric(maemo-classic)") }} CSS pseudo-class.

{{ h2_gecko_minversion("-moz-device-pixel-ratio", "2.0") }}

Value: {{ xref_cssnumber() }}
Media: {{ Xref_cssvisual() }}
Accepts min/max prefixes: yes

Gives the number of device pixels per CSS pixel.

Do not use this feature.

Use the resolution feature with the dppx unit instead.

-moz-device-pixel-ratio may be used for compatibility with Firefox older than 16 and -webkit-device-pixel-ratio with WebKit-based browsers that do not support dppx.

Example:

@media (-webkit-min-device-pixel-ratio: 2), /* Webkit-based browsers */
       (min--moz-device-pixel-ratio: 2),    /* Older Firefox browsers (prior to Firefox 16) */
       (min-resolution: 2dppx),             /* The standard way */
       (min-resolution: 192dpi)             /* dppx fallback */ 

See this CSSWG article for compatibility good practices regarding resolution and dppx.

Note: This media feature is also implemented by Webkit as -webkit-device-pixel-ratio. The min and max prefixes as implemented by Gecko are named min--moz-device-pixel-ratio and max--moz-device-pixel-ratio; but the same prefixes as implemented by Webkit are named -webkit-min-device-pixel-ratio and -webkit-max-device-pixel-ratio.

{{ h2_gecko_minversion("-moz-scrollbar-end-backward", "1.9.2") }}

Value: {{ xref_cssinteger() }}
Media: {{ Xref_cssvisual() }}
Accepts min/max prefixes: no

If the device's user interface displays a backward arrow button at the end of scrollbars, this is 1. Otherwise it's 0.

This corresponds to the {{ cssxref(":-moz-system-metric(scrollbar-end-backward)") }} CSS pseudo-class.

{{ h2_gecko_minversion("-moz-scrollbar-end-forward", "1.9.2") }}

Value: {{ xref_cssinteger() }}
Media: {{ Xref_cssvisual() }}
Accepts min/max prefixes: no

If the device's user interface displays a forward arrow button at the end of scrollbars, this is 1. Otherwise it's 0.

This corresponds to the {{ cssxref(":-moz-system-metric(scrollbar-end-forward)") }} CSS pseudo-class.

{{ h2_gecko_minversion("-moz-scrollbar-start-backward", "1.9.2") }}

Value: {{ xref_cssinteger() }}
Media: {{ Xref_cssvisual() }}
Accepts min/max prefixes: no

If the device's user interface displays a backward arrow button at the beginning of scrollbars, this is 1. Otherwise it's 0.

This corresponds to the {{ cssxref(":-moz-system-metric(scrollbar-start-backward)") }} CSS pseudo-class.

{{ h2_gecko_minversion("-moz-scrollbar-start-forward", "1.9.2") }}

Value: {{ xref_cssinteger() }}
Media: {{ Xref_cssvisual() }}
Accepts min/max prefixes: no

If the device's user interface displays a forward arrow button at the beginning of scrollbars, this is 1. Otherwise it's 0.

This corresponds to the {{ cssxref(":-moz-system-metric(scrollbar-start-forward)") }} CSS pseudo-class.

{{ h2_gecko_minversion("-moz-scrollbar-thumb-proportional", "1.9.2") }}

Value: {{ xref_cssinteger() }}
Media: {{ Xref_cssvisual() }}
Accepts min/max prefixes: no

If the device's user interface displays the thumb of scrollbars proportionally (that is, sized based on the percentage of the document that is visible), this is 1. Otherwise it's 0.

This corresponds to the {{ cssxref(":-moz-system-metric(scrollbar-thumb-proportional)") }} CSS pseudo-class.

{{ h2_gecko_minversion("-moz-touch-enabled", "1.9.2") }}

Value: {{ xref_cssinteger() }}
Media: {{ Xref_cssvisual() }}
Accepts min/max prefixes: no

If the device supports touch events (for a touch screen), this is 1. Otherwise it's 0.

This corresponds to the {{ cssxref(":-moz-system-metric(touch-enabled)") }} CSS pseudo-class.

Example

You might use this to render your buttons slightly larger, for example, if the user is on a touch-screen device, to make them more finger-friendly.

{{ h2_gecko_minversion("-moz-windows-classic", "1.9.2") }}

Value: {{ xref_cssinteger() }}
Media: {{ Xref_cssvisual() }}
Accepts min/max prefixes: no

If the user is using Windows unthemed (in classic mode instead of using uxtheme), this is 1; otherwise it's 0.

This corresponds to the {{ cssxref(":-moz-system-metric(windows-classic)") }} CSS pseudo-class.

{{ h2_gecko_minversion("-moz-windows-compositor", "1.9.2") }}

Value: {{ xref_cssinteger() }}
Media: {{ Xref_cssvisual() }}
Accepts min/max prefixes: no

If the user is using Windows with the DWM compositor, this is 1; otherwise it's 0.

This corresponds to the {{ cssxref(":-moz-system-metric(windows-compositor)") }} CSS pseudo-class.

{{ h2_gecko_minversion("-moz-windows-default-theme", "1.9.2") }}

Value: {{ xref_cssinteger() }}
Media: {{ Xref_cssvisual() }}
Accepts min/max prefixes: no

If the user is currently using one of the default Windows themes (Luna, Royale, Zune, or Aero (including Vista Basic, Vista Advanced, and Aero Glass), this is 1. Otherwise it's 0.

This corresponds to the {{ cssxref(":-moz-system-metric(windows-default-theme)") }} CSS pseudo-class.

{{ h2_gecko_minversion("-moz-windows-theme", "2.0") }}

Value: aero | luna-blue | luna-olive | luna-silver | royale | generic | zune
Media: {{ Xref_cssvisual() }}
Accepts min/max prefixes: no

Indicates which Windows theme is currently being used. Only available on Windows. Possible values are:

  • aero
  • luna-blue
  • luna-olive
  • luna-silver
  • royale
  • generic
  • zune

This is provided for application skins and other chrome code to be able to adapt to work well with the current Windows theme.

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{ CompatChrome("21") }} {{ CompatGeckoDesktop("1.9.1") }} {{ CompatIE("9.0") }} {{ CompatOpera("9") }} {{ CompatSafari("4") }}
grid {{ CompatUnknown() }} {{ CompatNo() }} (grid media type is not supported) {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}
resolution {{ CompatUnknown() }} {{ CompatGeckoDesktop("1.9.1") }} supports {{ xref_cssinteger() }} values;
{{ CompatGeckoDesktop("8.0") }} supports {{ xref_cssnumber() }} values, as per the spec.
{{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}
scan {{ CompatUnknown() }} {{ CompatNo() }} (tv media type is not supported) {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{ CompatVersionUnknown() }} {{ CompatVersionUnknown() }} {{ CompatUnknown() }} {{ CompatVersionUnknown() }} {{ CompatVersionUnknown() }}

See also

Revision Source

<p>A <strong>media query</strong> consists of a media type and at least one expression that limits the style sheets' scope by using media features, such as width, height, and color. Added in <a href="/en-US/docs/CSS/CSS3" title="/en-US/docs/CSS/CSS3">CSS3</a>, media queries let the presentation of content be tailored to a specific range of output devices without having to change the content itself.</p>
<h2 id="Syntax">Syntax</h2>
<p>Media queries consist of a <a class="internal" href="/en-US/docs/CSS/@media" title="/en-US/docs/CSS/@media">media type</a> and can, as of the CSS3 specification, contain one or more expressions, expressed as media features, which resolve to either true or false.&nbsp; The result of the query is true if the media type specified in the media query matches the type of device the document is being displayed on <strong>and</strong> all expressions in the media query are true.</p>
<p>When a media query is true, the corresponding style sheet or style rules are applied, following the normal cascading rules. Style sheets with media queries attached to their <code>&lt;link&gt;&nbsp;</code>tags <a href="http://scottjehl.github.com/CSS-Download-Tests/" title="http://scottjehl.github.com/CSS-Download-Tests/">will still download</a>&nbsp;even if their media queries would return false (they will not apply, however).</p>
<p>Unless using the&nbsp;<code>not</code> nor <code>only</code> operators, the media type is optional and the&nbsp;<code>all</code><span style="line-height: 1.572;">&nbsp;</span><span style="line-height: 1.572;">type will be implied</span><span style="font-family: 'Courier New', 'Andale Mono', monospace; line-height: normal;">.</span></p>
<h3 id="Logical_operators">Logical operators</h3>
<p>You can compose complex media queries using logical operators, including <code>not</code>, <code>and</code>, and <code>only</code>. The <code>and</code>&nbsp;operator is used for combining multiple <a href="#Media_features" title="#Media_features">media features</a> together into a single media query, requiring each chained feature to return true in order for the query to be true. The <code>not</code> operator is used to negate an entire media query. The <code>only</code> operator is used to apply a style only if the entire query matches, useful for preventing older browsers from applying selected styles. Both the <code>not</code> and the <code>only</code> operators require a media type in order to be evaluated, <code>all</code> is not implied.</p>
<p>In addition, you can combine multiple media queries in a comma-separated list; if any of the media queries in the list is true, the entire media statement returns true. This is equilivant to an <code>or</code> operator.</p>
<h4 id="and">and</h4>
<p>The <code>and</code> keyword is used for combining multiple media features together, as well as combining media features with media types. A basic media query, a single media feature with the implied <code>all</code> media type, could look like this:</p>
<pre>
@media (min-width: 700px) {&nbsp;... }</pre>
<p>If, however, you wanted this to apply only if the display is in landscape, you could use an <code>and</code> operator to chain the media features together.</p>
<pre>
@media (min-width: 700px) and (orientation: landscape) {&nbsp;... }</pre>
<p>Now the above media query will only return true if the viewport is 700px wide or wider and the display is in landscape. If, however, you only wanted this to apply if the display in question was of the media type TV, you could chain these features with a media type using an <code>and</code> operator.</p>
<pre>
@media tv and (min-width: 700px) and (orientation: landscape) {&nbsp;... }</pre>
<p>Now, the above media query will only apply if the media type is TV, the viewport is 700px wide or wider, and the display is in landscape.</p>
<h4 id="comma-separated_lists">comma-separated lists</h4>
<p>Comma-separated lists behave like the logical opeartor&nbsp;<code>or</code>&nbsp;when used in media queries. When using a comma-separated list of media queries, if any of the media queries returns true, the styles or style sheets get applied. Each media query in a comma-separated list is treated as an individual query, and any operator applied to one media query does not affect the others. This means the comma-separated media queries can target different media features, types, and states.</p>
<p>For instance, if you wanted to apply a set of styles if the viewing device either had a minimum width of 700px or was a handheld in landscape, you could write the following:</p>
<pre>
@media (min-width: 700px), handheld and (orientation: landscape) {&nbsp;... }</pre>
<p>Above, if I were on a <code>screen</code>&nbsp;device with a viewport width of 800px, the media statement would return true because the first part, interperated as&nbsp;<code>@media all and (min-width: 700px)</code> would apply to my device and therefore return true, despite the fact that my&nbsp;<code>screen</code> device would fail the&nbsp;<code>handheld</code> media type check in the second media query. Likewise, if I were on a&nbsp;<code>handheld</code> device held in landscape with a viewport width of 500px, while the first media query would fail due to the viewport width, the second media query would succeed and thus the media statement would return true.</p>
<h4 id="not">not</h4>
<p>The <code>not</code> keyword applies to the whole media query and returns true if the media query would otherwise return false (such as <code>monochrome</code> on a color display or a screen width of 600px with a <code>min-width: 700px</code> feature query). A <code>not</code> will only negate the media query it is applied to and not to every media query if present in a comma-separated list of media queries. The <code>not</code> keyword cannot be used to negate an individual feature query, only an entire media query.&nbsp;<span style="line-height: 1.572;">For example, the&nbsp;</span><code style="font-size: 14px;">not</code><span style="line-height: 1.572;">&nbsp;is evaluated last in the following query:</span></p>
<pre style="font-size: 14px;">
@media not all and (monochrome) {&nbsp;... }
</pre>
<p>This means that the query is evaluated like this:</p>
<pre style="font-size: 14px;">
@media not (all and (monochrome)) { ... }
</pre>
<p>... rather than like this:</p>
<pre style="font-size: 14px;">
@media (not all) and (monochrome) { ... }</pre>
<p>As another example, look at the following media query:</p>
<pre style="font-size: 14px;">
@media not screen and (color), print and (color)
</pre>
<p>It is evaluated like this:</p>
<pre style="font-size: 14px;">
@media (not (screen and (color))), print and (color)</pre>
<h4 id="only">only</h4>
<p><span style="line-height: 21px;">The&nbsp;</span><code style="font-size: 14px;">only</code><span style="line-height: 21px;">&nbsp;keyword prevents older browsers that do not support media queries with media features from applying the given styles:</span></p>
<pre>
&lt;link rel="stylesheet"&nbsp;media="only screen and (color)" href="example.css" /&gt;
</pre>
<h3 id="Pseudo-BNF_(for_those_of_you_that_like_that_kind_of_thing)">Pseudo-BNF (for those of you that like that kind of thing)</h3>
<pre>
media_query_list: &lt;media_query&gt; [, &lt;media_query&gt; ]*
media_query: [[only | not]? &lt;media_type&gt; [ and &lt;expression&gt; ]*]
  | &lt;expression&gt; [ and &lt;expression&gt; ]*
expression: ( &lt;media_feature&gt; [: &lt;value&gt;]? )
media_type: all | aural | braille | handheld | print |
  projection | screen | tty | tv | embossed
media_feature: width | min-width | max-width
  | height | min-height | max-height
  | device-width | min-device-width | max-device-width
  | device-height | min-device-height | max-device-height
  | aspect-ratio | min-aspect-ratio | max-aspect-ratio
  | device-aspect-ratio | min-device-aspect-ratio | max-device-aspect-ratio
  | color | min-color | max-color
  | color-index | min-color-index | max-color-index
  | monochrome | min-monochrome | max-monochrome
  | resolution | min-resolution | max-resolution
  | scan | grid</pre>
<p>Media queries are case insensitive.&nbsp; Media queries involving unknown media types are always false.</p>
<div class="note">
  <strong>Note:</strong> Parentheses are required around expressions; failing to use them is an error.</div>
<h2 id="Media_features">Media features</h2>
<p>Most media features can be prefixed with "min-"&nbsp;or "max-" to express "greater or equal to"&nbsp;or "less than or equal to" constraints.&nbsp; This avoids using the "&lt;" and "&gt;"&nbsp;symbols, which would conflict with&nbsp;HTML&nbsp;and XML.&nbsp; If you use a media feature without specifying a value, the expression resolves to true if the feature's value is non-zero.</p>
<div class="note">
  <strong>Note:</strong> If a media feature doesn't apply to the device on which the browser is running, expressions involving that media feature are always false.&nbsp; For example, querying the aspect ratio of an aural device always results in false.</div>
<h3 id="color">color</h3>
<p><strong>Value:</strong> {{ Xref_csscolorvalue() }}<br />
  <span style="font-weight: bold;">Media</span><strong>:</strong> {{ Xref_cssvisual() }}<br />
  <strong>Accepts min/max prefixes:</strong> yes</p>
<p>Indicates the number of bits per color component of the output device.&nbsp; If the device is not a color device, this value is zero.</p>
<div class="note">
  <strong>Note:</strong> If the color components have different numbers of bits per color component, the smallest number is used.&nbsp; For example, if a display uses 5 bits for blue and red and 6 bits for green, then the device is considered to use 5 bits per color component.&nbsp; If the device uses indexed colors, the minimum number of bits per color component in the color table is used.</div>
<h4 id="Examples">Examples</h4>
<p>To apply a style sheet to all color devices:</p>
<pre>
@media all and (color) { ... }
</pre>
<p>To apply a style sheet to devices with at least 4 bits per color component:</p>
<pre>
@media all and (min-color: 4) { ... }
</pre>
<h3 id="color-index">color-index</h3>
<p><strong>Value:</strong> {{ xref_cssinteger() }}<br />
  <span style="font-weight: bold;">Media</span><strong>:</strong> {{ Xref_cssvisual() }}<br />
  <strong>Accepts min/max prefixes:</strong> yes</p>
<p>Indicates the number of entries in the color look-up table for the output device.</p>
<h4 id="Examples">Examples</h4>
<p>To indicate that a style sheet should apply to all devices using indexed color, you can do:</p>
<pre>
@media all and (color-index) { ... }
</pre>
<p>To apply a style sheet to indexed color devices with at least 256 colors:</p>
<pre>
&lt;link rel="stylesheet" media="all and (min-color-index:&nbsp;256)" href="http://foo.bar.com/stylesheet.css" /&gt;
</pre>
<h3 id="aspect-ratio">aspect-ratio</h3>
<p><strong>Value:</strong> {{ xref_cssratio() }}<br />
  <span style="font-weight: bold;">Media</span><strong>:</strong> {{ Xref_cssvisual() }}, {{ Xref_csstactile() }}<br />
  <strong>Accepts min/max prefixes:</strong> yes</p>
<p>Describes the aspect ratio of the targeted display area of the output device.&nbsp; This value consists of two positive integers separated by a slash ("/")&nbsp;character.&nbsp; This represents the ratio of horizontal pixels (first term) to vertical pixels (second term).</p>
<h4 id="Example">Example</h4>
<p>The following selects a special style sheet to use for when the display area is at least as wide as it is high.</p>
<pre>
@media screen and (min-aspect-ratio: 1/1) { ... }</pre>
<p>This selects the style when the aspect ratio is either 1:1 or greater. In other words, these styles will only be applied when the viewing area is square or landscape.</p>
<h3 id="device-aspect-ratio">device-aspect-ratio</h3>
<p><strong>Value:</strong> {{ xref_cssratio() }}<br />
  <span style="font-weight: bold;">Media</span><strong>:</strong> {{ Xref_cssvisual() }}, {{ Xref_csstactile() }}<br />
  <strong>Accepts min/max prefixes:</strong> yes</p>
<p>Describes the aspect ratio of the output device.&nbsp; This value consists of two positive integers separated by a slash ("/")&nbsp;character.&nbsp; This represents the ratio of horizontal pixels (first term) to vertical pixels (second term).</p>
<h4 id="Example">Example</h4>
<p>The following selects a special style sheet to use for widescreen displays.</p>
<pre>
@media screen and (device-aspect-ratio: 16/9), screen and (device-aspect-ratio: 16/10) { ... }</pre>
<p>This selects the style when the aspect ratio is either 16:9 or 16:10.</p>
<h3 id="device-height">device-height</h3>
<p><strong>Value:</strong> {{ Xref_csslength() }}<br />
  <span style="font-weight: bold;">Media</span><strong>:</strong> {{ Xref_cssvisual() }}, {{ Xref_csstactile() }}<br />
  <strong>Accepts min/max prefixes:</strong> yes</p>
<p>Describes the height of the output device (meaning the entire screen or page, rather than just the rendering area, such as the document window).</p>
<h4 id="Example">Example</h4>
<p>To apply a style sheet to a document when displayed on a screen that is less than 800 pixels wide, you can use this:</p>
<pre>
&lt;link rel="stylesheet"&nbsp;media="screen and (max-device-width: 799px)" /&gt;
</pre>
<h3 id="device-width">device-width</h3>
<p><strong>Value:</strong> {{ Xref_csslength() }}<br />
  <span style="font-weight: bold;">Media</span><strong>:</strong> {{ Xref_cssvisual() }}, {{ Xref_csstactile() }}<br />
  <strong>Accepts min/max prefixes:</strong> yes</p>
<p>Describes the width of the output device (meaning the entire screen or page, rather than just the rendering area, such as the document window).</p>
<h3 id="grid">grid</h3>
<p><strong>Value:</strong> {{ xref_cssinteger() }}<br />
  <span style="font-weight: bold;">Media</span><strong>:</strong> all<br />
  <strong>Accepts min/max prefixes:</strong> no</p>
<p>Determines whether the output device is a grid device or a bitmap device.&nbsp; If the device is grid-based (such as a TTY terminal or a phone display with only one font), the value is 1.&nbsp; Otherwise it is zero.</p>
<h4 id="Example">Example</h4>
<p>To apply a style to handheld devices with a 15-character or narrower display:</p>
<pre>
@media handheld and (grid) and (max-width: 15em) { ... }
</pre>
<div class="note">
  <strong>Note:</strong> The "em"&nbsp;unit has a special meaning for grid devices; since the exact width of an "em"&nbsp;can't be determined, 1em is assumed to be the width of one grid cell horizontally, and the height of one cell vertically.</div>
<h3 id="height">height</h3>
<p><strong>Value:</strong> {{ Xref_csslength() }}<br />
  <span style="font-weight: bold;">Media</span><strong>:</strong> {{ Xref_cssvisual() }}, {{ Xref_csstactile() }}<br />
  <strong>Accepts min/max prefixes:</strong> yes</p>
<p>The <code>height</code> media feature describes the height of the output device's rendering surface (such as the height of the viewport or of the page box on a printer).</p>
<div class="note">
  <strong>Note:</strong> As the user resizes the window, Firefox switches style sheets as appropriate based on media queries using the <code>width</code> and <code>height</code> media features.</div>
<h3 id="monochrome">monochrome</h3>
<p><strong>Value:</strong> {{ xref_cssinteger() }}<br />
  <span style="font-weight: bold;">Media</span><strong>:</strong> {{ Xref_cssvisual() }}<br />
  <strong>Accepts min/max prefixes:</strong> yes</p>
<p>Indicates the number of bits per pixel on a monochrome (greyscale)&nbsp;device.&nbsp; If the device isn't monochrome, the device's value is 0.</p>
<h4 id="Examples">Examples</h4>
<p>To apply a style sheet to all monochrome devices:</p>
<pre>
@media all and (monochrome) { ... }
</pre>
<p>To apply a style sheet to monochrome devices with at least 8 bits per pixel:</p>
<pre>
@media all and (min-monochrome: 8) { ... }
</pre>
<h3 id="orientation">orientation</h3>
<p><strong>Value:</strong> <code>landscape</code> | <code>portrait</code><br />
  <span style="font-weight: bold;">Media</span><strong>:</strong> {{ Xref_cssvisual() }}<br />
  <strong>Accepts min/max prefixes:</strong> no</p>
<p>Indicates whether the device is in landscape (the display is wider than it is tall)&nbsp;or portrait (the display is taller than it is wide)&nbsp;mode.</p>
<h4 id="Example">Example</h4>
<p>To apply a style sheet only in portrait orientation:</p>
<pre>
@media all and (orientation:&nbsp;portrait) { ... }</pre>
<h3 id="resolution">resolution</h3>
<p><strong>Value:</strong> {{ Xref_cssresolution() }}<br />
  <span style="font-weight: bold;">Media</span><strong>:</strong> {{ Xref_cssbitmap() }}<br />
  <strong>Accepts min/max prefixes:</strong> yes</p>
<p>Indicates the resolution (pixel density) of the output device.&nbsp; The resolution may be specified in either dots per inch (dpi) or dots per centimeter (dpcm).</p>
<h4 id="Example">Example</h4>
<p>To apply a style sheet to devices with at least 300 dots per inch of resolution:</p>
<pre>
@media print and (min-resolution: 300dpi) { ... }
</pre>
<h3 id="scan">scan</h3>
<p><strong>Value:</strong> <code>progressive</code> |&nbsp;<code>interlace</code><br />
  <span style="font-weight: bold;">Media</span><strong>:</strong> {{ Xref_csstv() }}<br />
  <strong>Accepts min/max prefixes:</strong> no</p>
<p>Describes the scanning process of television output devices.</p>
<h4 id="Example">Example</h4>
<p>To apply a style sheet only to progressive scanning televisions:</p>
<pre>
@media tv and (scan: progressive) { ... }
</pre>
<h3 id="width">width</h3>
<p><strong>Value:</strong> {{ Xref_csslength() }}<br />
  <span style="font-weight: bold;">Media</span><strong>:</strong> {{ Xref_cssvisual() }}, {{ Xref_csstactile() }}<br />
  <strong>Accepts min/max prefixes:</strong> yes</p>
<p>The <code>width</code> media feature describes the width of the rendering surface of the output device (such as the width of the document window, or the width of the page box on a printer).</p>
<div class="note">
  <strong>Note:</strong> As the user resizes the window, Firefox switches style sheets as appropriate based on media queries using the <code>width</code> and <code>height</code> media features.</div>
<h4 id="Examples">Examples</h4>
<p>If you want to specify a style sheet for handheld devices, or screen devices with a width greater than 20em, you can use this query:</p>
<pre>
@media handheld and (min-width: 20em), screen and (min-width: 20em) { ... }
</pre>
<p>This media query specifies a style sheet that applies to printed media wider than 8.5 inches:</p>
<pre>
&lt;link rel="stylesheet" media="print and (min-width:&nbsp;8.5in)"
    href="http://foo.com/mystyle.css" /&gt;
</pre>
<p>This query specifies a style sheet that is usable when the viewport is between 500 and 800 pixels wide:</p>
<pre>
@media screen and (min-width: 500px) and (max-width: 800px) { ... }
</pre>
<h2 id="Mozilla-specific_media_features">Mozilla-specific media features</h2>
<p>Mozilla offers several Gecko-specific media features. Some of these may be proposed as official media features.</p>
<p>{{ h2_gecko_minversion("-moz-images-in-menus", "1.9.2") }}</p>
<p><strong>Value:</strong> {{ xref_cssinteger() }}<br />
  <span style="font-weight: bold;">Media</span><strong>:</strong> {{ Xref_cssvisual() }}<br />
  <strong>Accepts min/max prefixes:</strong> no</p>
<p>If the device allows images to appear in menus, this is 1; otherwise, the value is 0. This corresponds to the {{ cssxref(":-moz-system-metric(images-in-menus)") }} CSS&nbsp;<a href="/en-US/docs/CSS/Pseudo-classes" title="Pseudo-classes">pseudo-class</a>.</p>
<p>{{ h2_gecko_minversion("-moz-mac-graphite-theme", "1.9.2") }}</p>
<p><strong>Value:</strong> {{ xref_cssinteger() }}<br />
  <span style="font-weight: bold;">Media</span><strong>:</strong> {{ Xref_cssvisual() }}<br />
  <strong>Accepts min/max prefixes:</strong> no</p>
<p>If the user has configured their device to use the "Graphite" appearance on Mac OS&nbsp;X, this is 1. If the user is using the standard blue appearance, or is not on Mac OS&nbsp;X, this is 0.</p>
<p>This corresponds to the {{ cssxref(":-moz-system-metric(mac-graphite-theme)") }} CSS <a href="/en-US/docs/CSS/Pseudo-classes" title="Pseudo-classes">pseudo-class</a>.</p>
<p>{{ h2_gecko_minversion("-moz-maemo-classic", "1.9.2") }}</p>
<p><strong>Value:</strong> {{ xref_cssinteger() }}<br />
  <span style="font-weight: bold;">Media</span><strong>:</strong> {{ Xref_cssvisual() }}<br />
  <strong>Accepts min/max prefixes:</strong> no</p>
<p>If the user is using Maemo with the original theme, this is 1; if it's using the newer Fremantle theme, this is 0.</p>
<p>This corresponds to the {{ cssxref(":-moz-system-metric(maemo-classic)") }} CSS <a href="/en-US/docs/CSS/Pseudo-classes" title="Pseudo-classes">pseudo-class</a>.</p>
<p>{{ h2_gecko_minversion("-moz-device-pixel-ratio", "2.0") }}</p>
<p><strong>Value:</strong> {{ xref_cssnumber() }}<br />
  <span style="font-weight: bold;">Media</span><strong>:</strong> {{ Xref_cssvisual() }}<br />
  <strong>Accepts min/max prefixes:</strong> yes</p>
<p>Gives the number of device pixels per CSS pixel.</p>
<div class="geckoVersionNote style-wrap">
  <p><strong>Do not use this feature. </strong></p>
  <p>Use the <code>resolution</code> feature with the <code>dppx</code> unit instead.<br />
    <br />
    <code>-moz-device-pixel-ratio</code> may be used for compatibility with Firefox older than 16 and <code>-webkit-device-pixel-ratio</code> with WebKit-based browsers that do not support <code>dppx</code>.</p>
  <p>Example:</p>
  <pre>
@media (-webkit-min-device-pixel-ratio: 2), /* Webkit-based browsers */
       (min--moz-device-pixel-ratio: 2),    /* Older Firefox browsers (prior to Firefox 16) */
       (min-resolution: 2dppx),             /* The standard way */
       (min-resolution: 192dpi)             /* dppx fallback */ </pre>
  <p>See this <a href="http://www.w3.org/blog/CSS/2012/06/14/unprefix-webkit-device-pixel-ratio/" title="http://www.w3.org/blog/CSS/2012/06/14/unprefix-webkit-device-pixel-ratio/">CSSWG article</a> for compatibility good practices regarding <code>resolution</code> and <code>dppx</code>.</p>
</div>
<div class="note">
  <strong>Note</strong>: This media feature is also implemented by Webkit as <span style="font-family: Courier New;">-webkit-device-pixel-ratio</span>. The min and max prefixes as implemented by Gecko are named <span style="font-family: Courier New;">min--moz-device-pixel-ratio</span> and <span style="font-family: Courier New;">max--moz-device-pixel-ratio</span>; but the same prefixes as implemented by Webkit are named <span style="font-family: Courier New;">-webkit-min-device-pixel-ratio</span> and <span style="font-family: Courier New;">-webkit-max-device-pixel-ratio</span>.</div>
<p>{{ h2_gecko_minversion("-moz-scrollbar-end-backward", "1.9.2") }}</p>
<p><strong>Value:</strong> {{ xref_cssinteger() }}<br />
  <span style="font-weight: bold;">Media</span><strong>:</strong> {{ Xref_cssvisual() }}<br />
  <strong>Accepts min/max prefixes:</strong> no</p>
<p>If the device's user interface displays a backward arrow button at the end of scrollbars, this is 1. Otherwise it's 0.</p>
<p>This corresponds to the {{ cssxref(":-moz-system-metric(scrollbar-end-backward)") }} CSS <a href="/en-US/docs/CSS/Pseudo-classes" title="Pseudo-classes">pseudo-class</a>.</p>
<p>{{ h2_gecko_minversion("-moz-scrollbar-end-forward", "1.9.2") }}</p>
<p><strong>Value:</strong> {{ xref_cssinteger() }}<br />
  <span style="font-weight: bold;">Media</span><strong>:</strong> {{ Xref_cssvisual() }}<br />
  <strong>Accepts min/max prefixes:</strong> no</p>
<p>If the device's user interface displays a forward arrow button at the end of scrollbars, this is 1. Otherwise it's 0.</p>
<p>This corresponds to the {{ cssxref(":-moz-system-metric(scrollbar-end-forward)") }} CSS <a href="/en-US/docs/CSS/Pseudo-classes" title="Pseudo-classes">pseudo-class</a>.</p>
<p>{{ h2_gecko_minversion("-moz-scrollbar-start-backward", "1.9.2") }}</p>
<p><strong>Value:</strong> {{ xref_cssinteger() }}<br />
  <span style="font-weight: bold;">Media</span><strong>:</strong> {{ Xref_cssvisual() }}<br />
  <strong>Accepts min/max prefixes:</strong> no</p>
<p>If the device's user interface displays a backward arrow button at the beginning of scrollbars, this is 1. Otherwise it's 0.</p>
<p>This corresponds to the {{ cssxref(":-moz-system-metric(scrollbar-start-backward)") }} CSS <a href="/en-US/docs/CSS/Pseudo-classes" title="Pseudo-classes">pseudo-class</a>.</p>
<p>{{ h2_gecko_minversion("-moz-scrollbar-start-forward", "1.9.2") }}</p>
<p><strong>Value:</strong> {{ xref_cssinteger() }}<br />
  <span style="font-weight: bold;">Media</span><strong>:</strong> {{ Xref_cssvisual() }}<br />
  <strong>Accepts min/max prefixes:</strong> no</p>
<p>If the device's user interface displays a forward arrow button at the beginning of scrollbars, this is 1. Otherwise it's 0.</p>
<p>This corresponds to the {{ cssxref(":-moz-system-metric(scrollbar-start-forward)") }} CSS <a href="/en-US/docs/CSS/Pseudo-classes" title="Pseudo-classes">pseudo-class</a>.</p>
<p>{{ h2_gecko_minversion("-moz-scrollbar-thumb-proportional", "1.9.2") }}</p>
<p><strong>Value:</strong> {{ xref_cssinteger() }}<br />
  <span style="font-weight: bold;">Media</span><strong>:</strong> {{ Xref_cssvisual() }}<br />
  <strong>Accepts min/max prefixes:</strong> no</p>
<p>If the device's user interface displays the thumb of scrollbars proportionally (that is, sized based on the percentage of the document that is visible), this is 1. Otherwise it's 0.</p>
<p>This corresponds to the {{ cssxref(":-moz-system-metric(scrollbar-thumb-proportional)") }} CSS <a href="/en-US/docs/CSS/Pseudo-classes" title="Pseudo-classes">pseudo-class</a>.</p>
<p>{{ h2_gecko_minversion("-moz-touch-enabled", "1.9.2") }}</p>
<p><strong>Value:</strong> {{ xref_cssinteger() }}<br />
  <span style="font-weight: bold;">Media</span><strong>:</strong> {{ Xref_cssvisual() }}<br />
  <strong>Accepts min/max prefixes:</strong> no</p>
<p>If the device supports touch events (for a touch screen), this is 1. Otherwise it's 0.</p>
<p>This corresponds to the {{ cssxref(":-moz-system-metric(touch-enabled)") }} CSS <a href="/en-US/docs/CSS/Pseudo-classes" title="Pseudo-classes">pseudo-class</a>.</p>
<h4 id="Example">Example</h4>
<p>You might use this to render your buttons slightly larger, for example, if the user is on a touch-screen device, to make them more finger-friendly.</p>
<p>{{ h2_gecko_minversion("-moz-windows-classic", "1.9.2") }}</p>
<p><strong>Value:</strong> {{ xref_cssinteger() }}<br />
  <span style="font-weight: bold;">Media</span><strong>:</strong> {{ Xref_cssvisual() }}<br />
  <strong>Accepts min/max prefixes:</strong> no</p>
<p>If the user is using Windows unthemed (in classic mode instead of using uxtheme), this is 1; otherwise it's 0.</p>
<p>This corresponds to the {{ cssxref(":-moz-system-metric(windows-classic)") }} CSS <a href="/en-US/docs/CSS/Pseudo-classes" title="Pseudo-classes">pseudo-class</a>.</p>
<p>{{ h2_gecko_minversion("-moz-windows-compositor", "1.9.2") }}</p>
<p><strong>Value:</strong> {{ xref_cssinteger() }}<br />
  <span style="font-weight: bold;">Media</span><strong>:</strong> {{ Xref_cssvisual() }}<br />
  <strong>Accepts min/max prefixes:</strong> no</p>
<p>If the user is using Windows with the DWM&nbsp;compositor, this is 1; otherwise it's 0.</p>
<p>This corresponds to the {{ cssxref(":-moz-system-metric(windows-compositor)") }} CSS <a href="/en-US/docs/CSS/Pseudo-classes" title="Pseudo-classes">pseudo-class</a>.</p>
<p>{{ h2_gecko_minversion("-moz-windows-default-theme", "1.9.2") }}</p>
<p><strong>Value:</strong> {{ xref_cssinteger() }}<br />
  <span style="font-weight: bold;">Media</span><strong>:</strong> {{ Xref_cssvisual() }}<br />
  <strong>Accepts min/max prefixes:</strong> no</p>
<p>If the user is currently using one of the default Windows themes (Luna, Royale, Zune, or Aero (including Vista Basic, Vista Advanced, and Aero Glass), this is 1. Otherwise it's 0.</p>
<p>This corresponds to the {{ cssxref(":-moz-system-metric(windows-default-theme)") }} CSS <a href="/en-US/docs/CSS/Pseudo-classes" title="Pseudo-classes">pseudo-class</a>.</p>
<p>{{ h2_gecko_minversion("-moz-windows-theme", "2.0") }}</p>
<p><strong>Value:</strong> <code>aero</code> | <code>luna-blue</code> | <code>luna-olive</code> | <code>luna-silver</code> | <code>royale</code> | <code>generic</code> | <code>zune</code><br />
  <span style="font-weight: bold;">Media</span><strong>:</strong> {{ Xref_cssvisual() }}<br />
  <strong>Accepts min/max prefixes:</strong> no</p>
<p>Indicates which Windows theme is currently being used. Only available on&nbsp;Windows. Possible values are:</p>
<ul>
  <li><code>aero</code></li>
  <li><code>luna-blue</code></li>
  <li><code>luna-olive</code></li>
  <li><code>luna-silver</code></li>
  <li><code>royale</code></li>
  <li><code>generic</code></li>
  <li><code>zune</code></li>
</ul>
<p>This is provided for application skins and other chrome code to be able to adapt to work well with the current Windows theme.</p>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{ CompatibilityTable() }}</p>
<div id="compat-desktop">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Chrome</th>
        <th>Firefox (Gecko)</th>
        <th>Internet Explorer</th>
        <th>Opera</th>
        <th>Safari</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{ CompatChrome("21") }}</td>
        <td>{{ CompatGeckoDesktop("1.9.1") }}</td>
        <td>{{ CompatIE("9.0") }}</td>
        <td>{{ CompatOpera("9") }}</td>
        <td>{{ CompatSafari("4") }}</td>
      </tr>
      <tr>
        <td>grid</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatNo() }} (<code>grid</code> media type is not supported)</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatUnknown() }}</td>
      </tr>
      <tr>
        <td>resolution</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatGeckoDesktop("1.9.1") }} supports {{ xref_cssinteger() }} values;<br />
          {{ CompatGeckoDesktop("8.0") }} supports {{ xref_cssnumber() }} values, as per the spec.</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatUnknown() }}</td>
      </tr>
      <tr>
        <td>scan</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatNo() }}&nbsp;(<code>tv</code> media type is not supported)</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatUnknown() }}</td>
      </tr>
    </tbody>
  </table>
</div>
<div id="compat-mobile">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Android</th>
        <th>Firefox Mobile (Gecko)</th>
        <th>IE Mobile</th>
        <th>Opera Mobile</th>
        <th>Safari Mobile</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{ CompatVersionUnknown() }}</td>
        <td>{{ CompatVersionUnknown() }}</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatVersionUnknown() }}</td>
        <td>{{ CompatVersionUnknown() }}</td>
      </tr>
    </tbody>
  </table>
</div>
<h2 id="See_also">See also</h2>
<ul>
  <li><a class="external" href="http://www.w3.org/TR/css3-mediaqueries/" title="http://www.w3.org/TR/css3-mediaqueries/">CSS 3 media query specification</a></li>
  <li><a class="internal" href="/en-US/docs/CSS/@media" title="En/CSS/@media">Media types</a></li>
  <li><a href="/en-US/docs/CSS/Using_media_queries_from_code" title="en/CSS/Using media queries from code">Using media queries from code</a></li>
</ul>
Revert to this revision