For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt, and this page is available as Markdown at /next/zh/api/css/properties/color.md.
Lynx
  • 简体中文
  • color

    介绍

    color 属性指定文本的颜色,也支持通过 gradient 设置文本渐变色效果。

    使用示例

    语法

    /* <named-color> values */
    color: red;
    color: orange;
    color: tan;
    
    /* <hex-color> values */
    color: #090;
    color: #009900;
    color: #090a;
    color: #009900aa;
    
    /* <rgb()> values */
    color: rgb(34, 12, 64, 0.6);
    color: rgba(34, 12, 64, 0.6);
    color: rgb(34 12 64 / 0.6);
    color: rgba(34 12 64 / 0.3);
    color: rgb(34 12 64 / 60%);
    color: rgba(34.6 12 64 / 30%);
    
    /* <hsl()> values */
    color: hsl(30, 100%, 50%, 0.6);
    color: hsla(30, 100%, 50%, 0.6);
    color: hsl(30 100% 50% / 0.6);
    color: hsla(30 100% 50% / 0.6);
    color: hsl(30 100% 50% / 60%);
    color: hsla(30.2 100% 50% / 60%);

    取值

    形式定义

    初始值透明色
    适用元素text
    是否支持继承no
    是否支持动画yes

    形式语法

    <color> | <gradient>

    注意事项

    gradient 类型时,只有 text 元件有效。

    兼容性

    LCD tables only load in the browser

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