:volume-locked

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

:volume-locked CSS 伪类选择器表示能够发出声音,但其音量目前被用户“锁定”的媒体元素,如 <audio><video>

用户代理可能根据用户偏好设置媒体的 mutedvolume 值(例如,在会话之间记住上次设置的值、基于每个网站的设置,或者其他方式)。被标记为 :volume-locked 的元素无法通过 JavaScript 静音、取消静音或更改音量。锁定状态是操作系统或用户代理的首选项。

语法

css
:volume-locked {
  /* ... */
}

示例

CSS

css
:volume-locked {
  border: 5px solid green;
}

video:volume-locked {
  border: 5px solid aqua;
}

规范

Specification
Selectors Level 4
# selectordef-volume-locked

浏览器兼容性

BCD tables only load in the browser

参见