background-color

The background-color CSS property sets the background color of an element, either through a color value or the keyword transparent.

Syntax

    background-color: red
    background-color: rgb(255, 255, 128)
    background-color: hsla(50%, 33%, 25%, 0.75)
    background-color: currentColor
    background-color: transparent
    background-color: #bbff00

    background-color: inherit

Values

<color>
Is a CSS <color> that describes the uniform color of the background. Even if one or several background-image are defined, this color can be affect the rendering, by transparency if the images aren’t opaque.

<!DOCTYPE HTML>
<html>
    <head>
        <title>CSS Tutorials</title>
        <style>
            .One {
                background-color: teal;
                color: white;
            } .Two {
                background-color: rgb(153, 102, 153);
                color: rgb(255, 255, 204);
            } .Three {
                background-color: #777799;
                color: #FFFFFF;
            }
        </style>
    </head>
    <body>
        <p class="One">
            First Style
        </p>
        <p class="Two">
            First Style
        </p>
        <p class="Three">
            First Style
        </p>
    </body>
</html>