--- title: prefers-reduced-motion slug: Web/CSS/@media/prefers-reduced-motion tags: - '@media' - CSS - Media Queries - Reference - media feature - メディアクエリ - メディア特性 translation_of: Web/CSS/@media/prefers-reduced-motion ---
prefers-reduced-motion は CSS のメディア特性で、ユーザーが余計な動きを最少化するよう要求したことを検出するために使用します。
重要: このページの下部に埋め込まれた例は、拡大縮小の動きがありますが、一部の読者には問題があるかもしれません。前庭運動障害をお持ちの方は、アニメーションを見る前に、お使いの端末のモーション軽減機能を有効にしてください。
no-preferencereduceFirefox では、 reduce の要求は以下の場合に尊重されます。
gtk-enable-animations = false を GTK 3 configuration file の [Settings] に追加する方法もあります。about:config: 数値型の設定項目 ui.prefersReducedMotion を追加し、値を 1 とします。この設定の変更は直ちに効果が現れます。この例では、既定でで拡大縮小アニメーションが使用されています。アクセシビリティ設定で Reduce Motion を有効にしている場合、このアニメーションは前庭運動に影響のないシンプルなディゾルブにトーンダウンされます。
<div class="animation">animated box</div>
.animation {
animation: pulse 1s linear infinite both;
}
/* Tone down the animation to avoid vestibular motion triggers like scaling or panning large objects. */
@media (prefers-reduced-motion) {
.animation {
animation-name: dissolve;
}
}
.animation {
background-color: #306;
color: #fff;
font: 1.2em sans-serif;
width: 10em;
padding: 1em;
border-radius: 1em;
text-align: center;
}
@keyframes pulse {
0% { transform: scale(1); }
25% { transform: scale(.9); }
50% { transform: scale(1); }
75% { transform: scale(1.1); }
100% { transform: scale(1); }
}
@keyframes dissolve {
0% { opacity: 1; }
50% { opacity: 0.8; }
100% { opacity: 1; }
}
{{EmbedLiveSample("Examples")}}
| 仕様書 | 状態 | 備考 |
|---|---|---|
| {{SpecName('CSS5 Media Queries', '#descdef-media-prefers-reduced-motion', 'prefers-reduced-motion')}} | {{Spec2('CSS5 Media Queries')}} | 初回定義 |
{{Compat("css.at-rules.media.prefers-reduced-motion")}}