::-moz-color-swatch

非标准: 该特性是非标准的,请尽量不要在生产环境中使用它!

::-moz-color-swatch CSS 伪元素是用于表示在 type="color"<input> 中选择的颜色的 Mozilla 扩展

备注: 除了 <input type="color"> 以外,使用 ::-moz-color-swatch 不会匹配任何内容,也没有任何效果。

语法

css
::-moz-color-swatch {
  /* ... */
}

示例

HTML

html
<input type="color" value="#de2020" />

CSS

css
input[type="color"]::-moz-color-swatch {
  border-radius: 10px;
  border-style: none;
}

结果

规范

不属于任何规范。

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
::-moz-color-swatch
Non-standard

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Non-standard. Check cross-browser support before using.

参见

  • 其他浏览器也使用类似的伪元素: