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

    Introduction

    The background-color CSS property sets the background color of an element.

    Examples

    Syntax

    /* 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);

    Values

    • <color>
      The uniform color of the background.

    • Default value transparent

    Formal definition

    Initial valuetransparent
    Applies toall elements
    Inheritedno
    Animatableyes

    Formal Syntax

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

    Difference between web

    • Not support special keywords like currentcolor
    • Not support global keywords like inheritinitial

    Compatibility

    LCD tables only load in the browser

    Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.