background-color

介绍

background-color 会设置元件的背景色,属性的值为颜色 <color>

使用示例

语法

/* Keyword values */
background-color: red;

/* Hexadecimal value */
background-color: #bbff00;

/* RGB value */
background-color: rgb(255, 255, 128);

/* HSLA value */
background-color: hsla(50, 33%, 25%, 0.75);

取值

  • <color>
    描述背景颜色。该属性只能指定一个颜色值。

  • 默认值 transparent

形式定义

初始值transparent
适用元素all elements
是否支持继承no
是否支持动画yes

形式语法

<bg-color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color>

与 Web 的区别

  • 不支持特殊关键字,例如 currentcolor
  • 不支持全局关键字,例如 inheritinitial

兼容性

LCD tables only load in the browser

除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。