Skip to content

Commit f3ad439

Browse files
Chen Hui Jingfrivoal
authored andcommitted
[css-mediaqueries] Add 'prefers-reduced-data'
Closes #2370
1 parent f2fb337 commit f3ad439

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

mediaqueries-5/Overview.bs

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,61 @@ Detecting a forced color palette: the 'forced-colors' feature</h3>
688688
See [[!css-color-adjust-1#forced]] for details.
689689
</dl>
690690

691+
<h3 id="prefers-reduced-data">
692+
Detecting the desire for reduced data usage when loading a page: the 'prefers-reduced-data' feature</h3>
693+
694+
<pre class='descdef mq'>
695+
Name: prefers-reduced-data
696+
Value: no-preference | reduce
697+
For: @media
698+
Type: discrete
699+
</pre>
700+
701+
The 'prefers-reduced-data' media feature is used to detect if the user
702+
has a preference for being served alternate content that uses less
703+
data for the page to be rendered.
704+
705+
<dl dfn-type=value dfn-for="@media/prefers-reduced-data">
706+
<dt><dfn>no-preference</dfn>
707+
<dd>
708+
Indicates that the user has made no preference known
709+
to the system. This keyword value evaluates as false
710+
in the <a>boolean context</a>.
711+
712+
<dt><dfn>reduce</dfn>
713+
<dd>
714+
Indicates that user has expressed the preference for
715+
lightweight alternate content.
716+
</dl>
717+
718+
The method by which the user expresses their preference can vary.
719+
It might be a system-wide setting exposed by the Operating System,
720+
or a setting controlled by the User Agent.
721+
722+
Note: User Agents may consider setting this based on the same user
723+
or system preference as they use to set the
724+
<a href="https://wicg.github.io/savedata/">Save-Data</a> HTTP request
725+
header.
726+
727+
<div class="example">
728+
For example, a site could honour the preference of a user who
729+
has turned on data-saving mode by serving a smaller image.
730+
731+
<pre>
732+
.image {
733+
background-image: url("images/heavy.jpg");
734+
}
735+
736+
@media (prefers-reduced-data: reduce) {
737+
/* Save-Data: On */
738+
.image {
739+
background-image: url("images/light.jpg");
740+
}
741+
}
742+
</pre>
743+
</div>
744+
745+
691746
<h2 id="changes" class="no-num">
692747
Changes</h2>
693748
<h3 id="changes-level-5">

0 commit comments

Comments
 (0)