大网数据广告活动
Web 标准与前端开发

::cue (:cue)

· 52CE 我爱测

::cue CSS 伪元素匹配所选元素中的WebVTT提示。这可以用于在 VTT 轨道的媒体中使用字幕和其他线索。

::cue CSS 伪元素匹配所选元素中的WebVTT提示。这可以用于在 VTT 轨道的媒体中使用字幕和其他线索。

只有 CSS 一小部分属性可以与 ::cue 伪元素一起使用:

  • color
  • opacity
  • visibility
  • text-decoration and its longhand properties: text-decoration-line, text-decoration-color, and text-decoration-style
  • text-shadow
  • background and its longhand properties: background-color, background-clip, background-image, background-origin, background-position, background-repeat, background-size, background-attachment, and background-blend-mode
  • outline and its longhand properties: outline-color, outline-style, outline-width
  • font and its longhand properties: font-kerning, font-style, font-variant, font-variant-numeric, font-variant-position, font-variant-east-asian, font-variant-caps, font-variant-alternates, font-variant-ligatures, font-synthesis, font-feature-settings, font-language-override, font-weight, font-size, font-size-adjust, font-stretch, and font-family
  • line-height
  • white-space
  • text-combine-upright
  • ruby-position

属性应用于整个提示集,就像它们是单个单元一样。唯一的例外是背景及其简写属性可以单独应用于每个提示,以避免创建框并遮盖意外大面积的媒体。

语法

::cue | ::cue(<selector>) {
  /* ... */
}

示例

以下 CSS 设置提示样式,使文本为白色,背景为半透明黑盒。

::cue {
  color: #fff;
  background-color: rgba(0, 0, 0, 0.6);
}

规范

浏览器兼容性

参考

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。