Skip to main content

Colors in CSS

Ways to declare Colors in CSS

Ways to declare Colors in CSS
(Image by - Sharma Guides | Subham232330)


1. Color Name

2. Hex Value

3. RGB() and RGBA()

4. HSL() and HSLA()

5. HWB()




* Color Name:- background-color:red;

* HEX Value:- background-color:#001122;

* RGB():- background-color:rgb(25,31,52);

* RGBA():- background-color:rgba(0,0,0,1.5);
        |
        Transparency


The hexadecimal system uses values from 0 to 255 but in RGB we can use 0% to 100% as well.


Comments