From 968f40912f7fe99860a8df40971f165b3eb8c95b Mon Sep 17 00:00:00 2001
From: Sebastian Zartner To query for the size of the viewport (or the page box
on page media), the '@media/width', '@media/height' and aspect-ratio media features
- should be used, rather than 'device-width', 'device-height' and
- 'device-aspect-ratio', which refer to the physical size of the device
+ should be used, rather than '@media/device-width', '@media/device-height' and
+ '@media/device-aspect-ratio', which refer to the physical size of the device
regardless of how much space is available for the document being laid out. The
device-* media features are also sometimes used as a proxy to detect
mobile devices. Instead, authors should use media features that better
@@ -3582,7 +3587,7 @@ device-width
Type: range
- The 'device-width' media feature describes the width of the rendering surface of the output device.
+ The '@media/device-width' media feature describes the width of the rendering surface of the output device.
For [=continuous media=], this is the width of the Web-exposed screen area.
For [=paged media=], this is the width of the page sheet size.
@@ -3611,7 +3616,7 @@ device-height
Type: range
- The 'device-height' media feature describes the height of the rendering surface of the output device.
+ The '@media/device-height' media feature describes the height of the rendering surface of the output device.
For [=continuous media=], this is the height of the Web-exposed screen area.
For [=paged media=], this is the height of the page sheet size.
@@ -3636,9 +3641,9 @@ device-aspect-ratio
Type: range
- The 'device-aspect-ratio media feature is defined as the ratio of
- the value of the 'device-width' media feature to
- the value of the 'device-height media feature.
+ The '@media/device-aspect-ratio' media feature is defined as the ratio of
+ the value of the '@media/device-width' media feature to
+ the value of the '@media/device-height' media feature.
@@ -348,7 +352,7 @@ Media Types
but the definition of media types as mutually exclusive
makes it difficult to use them in a reasonable manner;
instead, their exclusive aspects are better expressed as media features
- such as '@media/grid' or 'scan'.
+ such as '@media/grid' or '@media/scan'.
As such, the following media types are defined for use in media queries:
@@ -447,9 +451,9 @@ Media Features
the media feature must always evaluate to false.
<link media="speech and (device-aspect-ratio: 16/9)"
@@ -463,7 +467,7 @@ Media Feature Types: “range” and “discrete”
Every media feature defines its “type” as either “range” or “discrete” in its definition table.
“Discrete” media features,
- like 'pointer'
+ like '@media/pointer'
take their values from a set.
The values may be keywords
or boolean numbers (0 and 1),
@@ -519,7 +523,7 @@ Evaluating Media Features in a Boolean Context
@media (min-orientation:portrait) { … }
- The 'orientation' feature does not accept prefixes,
+ The '@media/orientation' feature does not accept prefixes,
so this is considered an unknown media feature,
and turned into ''not all''.
-Orientation: the 'orientation' feature
+Orientation: the '@media/orientation' feature
Name: orientation
@@ -1151,11 +1155,11 @@ Orientation: the 'orientation' feature
Vertical Viewport Segments: the '@media/vertical-viewport-segments' feature
@@ -1273,9 +1277,9 @@ Vertical Viewport Segments: the '@media/vertical-viewport-segments' feature
The '@media/vertical-viewport-segments' media feature describes the number of logical segments of
- the viewport in the vertical direction.
+ the viewport in the vertical direction.
- The '@media/vertical-viewport-segments' media feature is false in the negative range.
+ The '@media/vertical-viewport-segments' media feature is false in the negative range.
-Display Modes: the ''display-mode'' media feature
+Display Modes: the '@media/display-mode' media feature
Name: display-mode
@@ -1367,7 +1371,7 @@ Display Modes: the ''display-mode'' media feature
-Display Resolution: the 'resolution' feature
+Display Resolution: the '@media/resolution' feature
Name: resolution
@@ -1423,13 +1427,13 @@ Display Resolution: the 'resolution' feature
Type: range
- The 'resolution' media feature describes the resolution of the output
+ The '@media/resolution' media feature describes the resolution of the output
device, i.e. the density of the pixels, taking into account the page zoom
but assuming a pinch zoom of 1.0.
- The 'resolution' media feature is false in the negative range
+ The '@media/resolution' media feature is false in the negative range
- When querying media with non-square pixels, 'resolution' queries the density in the vertical dimension.
+ When querying media with non-square pixels, '@media/resolution' queries the density in the vertical dimension.
For printers, this corresponds to the screening resolution
(the resolution for printing dots of arbitrary color).
@@ -1479,7 +1483,7 @@ Display Resolution: the 'resolution' feature
-Display Type: the 'scan' feature
+Display Type: the '@media/scan' feature
Name: scan
@@ -1488,7 +1492,7 @@ Display Type: the 'scan' feature
Type: discrete
- The 'scan' media feature describes the scanning process of some output devices.
+ The '@media/scan' media feature describes the scanning process of some output devices.
grid: 0 rather than grid: 1.
-Display Update Frequency: the 'update' feature
+Display Update Frequency: the '@media/update' feature
Name: update
@@ -1567,7 +1571,7 @@ Display Update Frequency: the 'update' feature
Type: discrete
- The 'update' media feature is used to query the ability of the output device
+ The '@media/update' media feature is used to query the ability of the output device
to modify the appearance of content once it has been rendered.
It accepts the following values:
@@ -1606,56 +1610,56 @@ Display Update Frequency: the 'update' feature
-Detecting the display technology: the 'environment-blending' feature
+Detecting the display technology: the '@media/environment-blending' feature
-
- Name: environment-blending
- Value: opaque | additive | subtractive
- For: @media
- Type: discrete
-
+
+ Name: environment-blending
+ Value: opaque | additive | subtractive
+ For: @media
+ Type: discrete
+
- The 'environment-blending' media feature is used to query the characteristics of the user's display
- so the author can adjust the style of the document.
- An author might choose to adjust the visuals and/or layout of the page depending on the display
- technology to increase the appeal or improve legibility.
+ The '@media/environment-blending' media feature is used to query the characteristics of the user's display
+ so the author can adjust the style of the document.
+ An author might choose to adjust the visuals and/or layout of the page depending on the display
+ technology to increase the appeal or improve legibility.
- The following values are valid:
+ The following values are valid:
-
-
- Issue: Is there a need for the ''subtractive'' value?
+ Issue: Is there a need for the ''subtractive'' value?
-
+
+ For example: an LCD display embedded in a bathroom mirror.
+
- body { background-color: white; }
- p { color: black; }
+
+
+ body { background-color: white; }
+ p { color: black; }
- @media(environment-blending: additive) {
- body { background-color: black; }
- p { color: white; font-size: 16px; font-weight: 1000; }
- }
-
-
User Preference Media Features
-Detecting the desire for less motion on the page: the 'prefers-reduced-motion' feature
+Detecting the desire for less motion on the page: the '@media/prefers-reduced-motion' feature
Name: prefers-reduced-motion
@@ -2764,7 +2768,7 @@ Detecting the desire for less motion on the page: the 'prefers-reduced-motion' f
Type: discrete
- The 'prefers-reduced-motion' media feature is used to detect if the user
+ The '@media/prefers-reduced-motion' media feature is used to detect if the user
has requested the system minimize the amount of non-essential motion
it uses.
@@ -2785,7 +2789,7 @@ Detecting the desire for less motion on the page: the 'prefers-reduced-motion' f
-Detecting the desire for reduced transparency on the page: the 'prefers-reduced-transparency' feature
+Detecting the desire for reduced transparency on the page: the '@media/prefers-reduced-transparency' feature
Name: prefers-reduced-transparency
@@ -2794,7 +2798,7 @@ Detecting the desire for reduced transparency on the page: the 'prefers-reduced-
Type: discrete
- The 'prefers-reduced-transparency' media feature is used to detect if the user
+ The '@media/prefers-reduced-transparency' media feature is used to detect if the user
has requested the system minimize the amount of transparent or translucent
layer effects it uses.
@@ -2816,7 +2820,7 @@ Detecting the desire for reduced transparency on the page: the 'prefers-reduced-
They're not about transparency, but they also interfere with shape recognition.
-Detecting the desire for increased or decreased color contrast from elements on the page: the 'prefers-contrast' feature
+Detecting the desire for increased or decreased color contrast from elements on the page: the '@media/prefers-contrast' feature
Name: prefers-contrast
@@ -2825,7 +2829,7 @@ Detecting the desire for increased or decreased color contrast from elements on
Type: discrete
- The 'prefers-contrast' media feature is used to detect
+ The '@media/prefers-contrast' media feature is used to detect
if the user has requested more or less contrast in the page.
This could be responded to, for example,
by adjusting the contrast ratio between adjacent colors,
@@ -2930,7 +2934,7 @@ Detecting the desire for increased or decreased color contrast from elements on
-Detecting Forced Colors Mode: the 'forced-colors' feature
+Detecting Forced Colors Mode: the '@media/forced-colors' feature
Name: forced-colors
@@ -2968,7 +2972,7 @@ Detecting Forced Colors Mode: the 'forced-colors' feature
Similarly,
if the forced color palette chosen by the user
- fits within one of the color schemes described by 'prefers-color-scheme',
+ fits within one of the color schemes described by '@media/prefers-color-scheme',
the corresponding value must also match.
-Detecting the desire for light or dark color schemes: the 'prefers-color-scheme' feature
+Detecting the desire for light or dark color schemes: the '@media/prefers-color-scheme' feature
Name: prefers-color-scheme
@@ -2994,7 +2998,7 @@ Detecting the desire for light or dark color schemes: the 'prefers-color-scheme'
Type: discrete
- The 'prefers-color-scheme' media feature reflects the user's
+ The '@media/prefers-color-scheme' media feature reflects the user's
desire that the page use a light or dark color theme.
@@ -3029,7 +3033,7 @@ Detecting the desire for light or dark color schemes: the 'prefers-color-scheme'
and/or because inked text on blank paper prints better
than blank letterforms knocked out of an inked background).
UAs are expected to take such variances into consideration
- so that 'prefers-color-scheme' reflects preferences appropriate to the medium
+ so that '@media/prefers-color-scheme' reflects preferences appropriate to the medium
rather than preferences taken out of context.
If evaluated in an embedded SVG document
@@ -3074,7 +3078,7 @@ Detecting the desire for light or dark color schemes: the 'prefers-color-scheme'
-Detecting the desire for reduced data usage when loading a page: the 'prefers-reduced-data' feature
+Detecting the desire for reduced data usage when loading a page: the '@media/prefers-reduced-data' feature
Issue(10076): This feature may be an undesired source of fingerprinting,
with a bias towards low income with limited data.
@@ -3086,7 +3090,7 @@ Detecting the desire for reduced data usage when loading a page: the 'prefers-re
Type: discrete
- The 'prefers-reduced-data' media feature is used to detect if the user
+ The '@media/prefers-reduced-data' media feature is used to detect if the user
has a preference for being served alternate content that uses less
data for the page to be rendered.
@@ -3105,9 +3109,9 @@ Detecting the desire for reduced data usage when loading a page: the 'prefers-re
The method by which the user expresses their preference can vary.
It might be a system-wide setting exposed by the Operating System,
- or a setting controlled by the user agent. User agents may consider
- setting this based on the same user or system preference as they use to
- set the Save-Data
+ or a setting controlled by the user agent. User agents may consider
+ setting this based on the same user or system preference as they use to
+ set the Save-Data
HTTP request header.
Note: User agents are encouraged to use their own user centered discretion
@@ -3168,7 +3172,7 @@ Automatic handling of User Preferences
For instance, liquid crystal displays can be washed out and very hard to read
in brightly lit environments.
A device with such a screen and with an ambient light sensor
- could automatically switch 'prefers-contrast' to ''prefers-contrast/more''
+ could automatically switch '@media/prefers-contrast' to ''prefers-contrast/more''
when it detects conditions that would make the screen difficult to read.
A user agent on a device with an e-ink display
would not make the same adjustment,
@@ -3177,8 +3181,8 @@ Automatic handling of User Preferences
In the opposite situation,
user agents running of device with a light-emitting screen (LCD, OLED, etc.)
and an ambient light sensor
- could automatically switch 'prefers-contrast' to ''prefers-contrast/less''
- and 'prefers-color-scheme' to ''prefers-color-scheme/dark''
+ could automatically switch '@media/prefers-contrast' to ''prefers-contrast/less''
+ and '@media/prefers-color-scheme' to ''prefers-color-scheme/dark''
when used in a dim environment
where excessive contrast and brightness would be distracting or uncomfortable to the reader.
@@ -3189,8 +3193,8 @@ Automatic handling of User Preferences
allows for unlimited data or is on a metered plan.
-
-Script Control of User Preferences
+
+Script Control of User Preferences
It is common for website authors to want to respect the user's system preferences while also allowing
those preferences to be overridden. To help with this, this specification defines a way for authors to
@@ -3198,17 +3202,17 @@ override the [[#mf-user-preferences]] using the {{PreferenceManager}} interface.
This override allows the preference to integrate with various platform features that are affected by these preferences.
-
+
Extensions to the {{Navigator}} interface
-
+
{{preferences}} attribute
When getting the {{preferences}} attribute always return the same instance of the {{PreferenceManager}} object.
@@ -3218,15 +3222,15 @@ When getting the {{preferences}} attribute always return the same instance of th
-
+
{{colorScheme}} attribute
The {{colorScheme}} attribute is a {{PreferenceObject}} used to override the user's preference for the color scheme of the site.
@@ -3248,7 +3252,7 @@ If an override is set for this preference:
- The user agent MUST also use this override when sending [[USER-PREFERENCE-MEDIA-FEATURES-HEADERS#sec-ch-prefers-color-scheme]].
- The user agent MUST also use this override for any UA features that are normally affected by [[#prefers-color-scheme]].
-
+
{{contrast}} attribute
The {{contrast}} attribute is a {{PreferenceObject}} used to override the user's preference for the contrast of the site.
@@ -3272,7 +3276,7 @@ If an override is set for this preference:
Note: Unlike the media feature this preference is NOT able to be set to ''@media/prefers-contrast/custom'' as this is tightly coupled to the [[#forced-colors]].
-
+
{{reducedMotion}} attribute
The {{reducedMotion}} attribute is a {{PreferenceObject}} used to override the user's preference for reduced motion on the site.
@@ -3295,7 +3299,7 @@ If an override is set for this preference:
Note: An example of a UA feature that is affected by this preference could be disabling smooth scrolling, or pausing marquee elements.
-
+
{{reducedTransparency}} attribute
The {{reducedTransparency}} attribute is a {{PreferenceObject}} used to override the user's preference for reduced transparency on the site.
@@ -3316,7 +3320,7 @@ If an override is set for this preference:
- The user agent MUST also use this override when sending [[USER-PREFERENCE-MEDIA-FEATURES-HEADERS#sec-ch-prefers-reduced-transparency]].
- The user agent MUST also use this override for any UA features that are normally affected by [[#prefers-reduced-transparency]].
-
+
{{reducedData}} attribute
The {{reducedData}} attribute is a {{PreferenceObject}} used to override the user's preference for reduced data usage on the site.
@@ -3338,24 +3342,24 @@ If an override is set for this preference:
- The user agent MUST also use this override when calculating the [[SAVEDATA#savedata-attribute]].
- The user agent MUST also use this override for any UA features that are normally affected by [[#prefers-reduced-data]].
-
+
{{PreferenceObject}} interface
-
+
{{override}} attribute
+
{{PreferenceObject/value}} attribute
+
{{validValues}} attribute
+
{{onchange}} event handler attribute
The onchange attribute is an [=event handler IDL attribute=] for
@@ -3422,7 +3427,7 @@ update steps:
1. If |document| is null or |document| is not [=Document/fully active=], terminate this algorithm.
1. Fire an event named change at |preference|.
-
+
{{requestOverride()}} method
+
{{clearOverride()}} method
change at [=this=].
-Appendix B: Privacy Considerations
-
- This section is not normative.
-
-
- Appendix C: Security Considerations
-
- This section is not normative.
-
-
Changes
@@ -3741,11 +3673,11 @@ In addition to editorial changes and minor clarifications,
the following changes and additions were made to this module since the
2021-12-18 Working Draft:
-* Moved 'display mode' definition back to [[APPMANIFEST]] ('display-mode' media feature remains
+* Moved 'display mode' definition back to [[APPMANIFEST]] ('@media/display-mode' media feature remains
here). (See Issue 7306)
* Establish a normative reference for [[Display-P3]]
* Disallow use of ''layer'' as a media type, rather than merely treat it as an unknown one, for compatibility with [=cascade layers=].
-* Clarify intent of 'prefers-reduced-motion'
+* Clarify intent of '@media/prefers-reduced-motion'
* Added further discussion of fingerprinting vectors
video-height,
and video-resolution.
(See Issue 5044)
- * Renamed 'prefers-contrast' values high and low
+ * Renamed '@media/prefers-contrast' values high and low
to ''prefers-contrast/more'' and ''prefers-contrast'' less.
(See Issue 2943)
- * Rework the interaction between 'prefers-contrast' and 'forced-colors',
+ * Rework the interaction between '@media/prefers-contrast' and '@media/forced-colors',
retiring prefers-contrast: forced and introducing ''prefers-contrast/custom''.
(See Issue 5433)
and Issue 6036)
- * Added the 'horizontal-viewport-segments' and 'vertical-viewport-segments' media feature.
+ * Added the '@media/horizontal-viewport-segments' and '@media/vertical-viewport-segments' media feature.
(See Issue 6234)
- * Added the 'nav-controls' media feature.
+ * Added the '@media/nav-controls' media feature.
(See Issue 6234)
- * Make it possible for multiple values of 'dynamic-range' to match at the same time.
+ * Make it possible for multiple values of '@media/dynamic-range' to match at the same time.
(See Issue 6793)
@@ -3787,7 +3719,7 @@ The following additions were made to this module since the
-light-level, 'inverted-colors', and Custom Media Queries sections
+ Reinstate the light-level, '@media/inverted-colors', and Custom Media Queries sections
from earlier Media Queries Level 4 drafts.
Acknowledgments
@@ -3871,61 +3801,124 @@ This specification is the product of the W3C Working Group on
Cascading Style Sheets.
Comments from
- Adam Argyle,
- Amelia Bellamy-Royds,
- Andreas Lind,
- Andres Galante,
- Arve Bersvendsen,
- Björn Höhrmann,
- Chen Hui Jing,
- Chris Lilley,
- Chris Rebert,
- Christian Biesinger,
- Christoph Päper,
- Elika J. Etemad (fantasai),
- Emilio Cobos Álvarez,
- François Remy,
- Frédéric Wang,
- Fuqiao Xue,
- Greg Whitworth,
- Ian Pouncey,
- James Craig,
- Jay Harris,
- Jinfeng Ma,
- Kivi Shapiro,
- L. David Baron,
- Masataka Yakura,
- Matt Giuca,
- Melinda Grant,
- Michael Smith,
- Nicholas C. Zakas
- Patrick H. Lauke,
- Philipp Hoschka,
- Rick Byers,
- Rijk van Geijtenbeek,
- Rik Cabanier,
- Roger Gimson,
- Rossen Atanassov,
- Sam Sneddon,
- Sigurd Lerstad,
- Simon Kissane,
- Simon Pieters,
- Stephen Chenney,
- Steven Pemberton,
- Susan Lesch,
- Tantek Çelik,
- Thomas Wisniewski,
- Vi Nguyen,
- Xidorn Quan,
- Yves Lafon,
- akklesed,
- and 張俊芝
+Adam Argyle,
+Amelia Bellamy-Royds,
+Andreas Lind,
+Andres Galante,
+Arve Bersvendsen,
+Björn Höhrmann,
+Chen Hui Jing,
+Chris Lilley,
+Chris Rebert,
+Christian Biesinger,
+Christoph Päper,
+Elika J. Etemad (fantasai),
+Emilio Cobos Álvarez,
+François Remy,
+Frédéric Wang,
+Fuqiao Xue,
+Greg Whitworth,
+Ian Pouncey,
+James Craig,
+Jay Harris,
+Jinfeng Ma,
+Kivi Shapiro,
+L. David Baron,
+Masataka Yakura,
+Matt Giuca,
+Melinda Grant,
+Michael Smith,
+Nicholas C. Zakas
+Patrick H. Lauke,
+Philipp Hoschka,
+Rick Byers,
+Rijk van Geijtenbeek,
+Rik Cabanier,
+Roger Gimson,
+Rossen Atanassov,
+Sam Sneddon,
+Sigurd Lerstad,
+Simon Kissane,
+Simon Pieters,
+Stephen Chenney,
+Steven Pemberton,
+Susan Lesch,
+Tantek Çelik,
+Thomas Wisniewski,
+Vi Nguyen,
+Xidorn Quan,
+Yves Lafon,
+akklesed,
+and 張俊芝
improved this specification.
Privacy Considerations
-No new privacy considerations have been reported on this specification.
+ This section is not normative.
+
+Security Considerations
-No new security considerations have been reported on this specification.
+ This section is not normative.
+
+