这是 实验性技术
检查 浏览器兼容性表格 要小心谨慎在生产中使用这之前。

草案
此页面不完整。

prefers-reduced-transparency CSS media feature is used to detect if the user has requested that the system minimize the amount of transparency used across elements.

句法

no-preference

Indicates that the user has made no preference known to the system. This keyword value evaluates as false in the boolean context.

reduce

Indicates that user has notified the system that they prefer an interface that minimizes the amount of transparent or translucent layer effects.

User preferences

Currently no user agent implements this feature, although various operating systems do support such preferences and if this media query is ever implemented user agents will likely rely on the settings provided by the operating systems.

范例

注意: No browser currently implements this feature so the following example will not work.

This example has an annoying transparency effect by default.

HTML

<div class="transparency">transparent box</div>
					

CSS

.transparency {
  opacity: 0.5;
}
@media (prefers-reduced-transparency: reduce) {
  .transparency {
    opacity: 1;
  }
}
					

结果

规范

规范 状态 注释
Media Queries Level 5
The definition of 'prefers-reduced-transparency' in that specification.
编者草案 初始定义。

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.

更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
prefers-reduced-transparency media feature Experimental Chrome 不支持 No Edge 不支持 No Firefox 不支持 No IE 不支持 No Opera 不支持 No Safari 不支持 No WebView Android 不支持 No Chrome Android 不支持 No Firefox Android 不支持 No Opera Android 不支持 No Safari iOS 不支持 No Samsung Internet Android 不支持 No

图例

不支持

不支持

实验。期望将来行为有所改变。

实验。期望将来行为有所改变。

另请参阅

元数据

  • 最后修改: