HTML & CSS Color Code

CSS HTML Color
In CSS, font color is given by using css "color" Property.
The value of color is written in these three forms.
  • Color Name
  • Hexadecimal Color code
  • RGB Colors
Color Name
CSS include total 16,777,216 ( 1 Crore 67 Lakhs ) colours. However 17 colors are known by their by name. These colors are
aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, orange, purple, red, silver, teal, white, and yellow. Transparent is also a valid value. 

HTML Code-

<p style="color:red"> Color Red </p>
<p style="color:blue"> Color Blue </p>
<p style="color:green"> Color Green </p>
<p style="color:yellow"> Color Yellow </p> 

Output-
Color Red
Color Blue
Color Green
Color Yellow

Hexadecimal Color Code
We can also write color's value using HEXADECIMAL COLOR CODES.
Hexadecimal is basicly a 16 base number system where we use 16 different value and combine them to write a color.
In Hexadecimal color coding, our use: 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f.
Minimun value is 0, and maximum is f.
Way to write a color in Hexadecimal Color Code: #------;
There are total six digits. First two represent red, next two represents green and last two blue.
Black #000000;
White #ffffff;
Red #ff0000;
Green #00ff00;
Blue #0000ff;
Rest all color are mixture of above values;

HTML Code-

<p style="color:#ff0000"> Color Red </p>
<p style="color:#0000ff"> Color Blue </p>
<p style="color:#00ff00"> Color Green </p>
<p style="color:#000000"> Color Black </p>

Output-
Color Red
Color Blue
Color Green
Color Black

RGB Color Code
We can also write a color value using RGB( Red, Green, Blue) color value.
In RGB, we write a color using its value which lies in-between 0 and 255.
0 is minimum value and 255 is maximum.

HTML Code-

<p style="color:rgb(255,0,0)"> Color Red </p>
<p style="color:rgb(0,255,0)"> Color Green </p>
<p style="color:rgb(0,0,255)"> Color Blue </p>

Output-
Color Red
Color Green
Color Blue

Ashwani
Ashwani

This is a short biography of the post author. Maecenas nec odio et ante tincidunt tempus donec vitae sapien ut libero venenatis faucibus nullam quis ante maecenas nec odio et ante tincidunt tempus donec.

No comments:

Post a Comment