CSS Color
The color
property allows you to specify the color of the text inside an element. In CSS
you can apply color in one of the three ways:
Color
Name: There are more than 140 predefined color names that are recognized
by web browsers. Color is represented by predefined names.
Example black, red, yellow
HEX
Codes: There are six-digit codes that represent the amount of green, red
and blue in a color, preceded by the pound (#) sign. Hex values represent
values for red, green, and blue in hexadecimal code.
Example #adbb
RGB
Values: These express color in terms of how much red, green, and blue are
used to make it up. The value of red, green, and blue are expressed as a number
between 0 and 255.
Example rgb(100,200,100)
<style type="text/css">
p{
/* Color name*/
color: red;
}
h1{
/* RGB values*/
color: RGB(100, 200, 100);
}
h2 {
/* HEX Code*/
color: #adbb;
}
</style>
<p> This Color value by color name</p>
<h1>This Color value by RGB values </h1>
<h2>This Color value by HEX Code </h2>
Leave a comment
No Cmomments yet