CSS Color
The CSS color property specifies the color of the text.
One method of specifying the color of the text is using a color name: like red, green, blue, etc.
Here’s an example of changing the color of your font.
HTML
1 2 |
<p class="example">The text inside the paragraph is red.</p> The text outside the paragraph is black (by default). |
CSS
1 2 3 |
p.example { color: red; } |
OUTPUT

Another way of defining colors is using hexadecimal values and RGB.
The hexadecimal form is a pound sign (#) followed by at most, 6 hex values (0-F).
RGB defines the individual values for Red, Green, and Blue.
In the example below, we use hexadecimal value to set the heading color to blue, and RGB form to make the paragraph red.
HTML
1 2 |
<h1>Welcome to PHPGurukul | Programming Blog</h1> <p class="example">Welcome to PHPGurukul | Programming Blog</p> |
CSS
1 2 3 4 5 6 |
h1 { color: #0000FF; } p.example { color: rgb(255,0,0); } |
OUTPUT
