17 Aug 2015

How to apply color in CSS

-----HTML----

<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" href="css/primary.css">
    </head>
    <body>
        <div id="container">
            <span>This is some text</span>
        </div>
    </body>
</html>

-----CSS----

#container{
    background: #aaa;
}
#container span{
    color: rgba(0,0,0);
    opacity: 0.5;
}

Note: To apply Background color use background color  and to apply text color use only color in css

Share:

0 comments:

Post a Comment