HTML Color

HTML Color codes are a very important part of these websites. If you want a great website then colors should be used. In Web Pages we can use Color in many ways. We can change the color of different Headings, Text of Paragraphs, Page html background colorhtml font colorhtml font color, Borders etc. To add color to web pages, we have to use Hexa Decimal Codes. To use Colors, we have to use color and bgcolor attributes. These are both Deprecated Attributes, which we can not use in Strict XHTML.

HTML Color Codes

Color NameHex Color CodeRGB Color Code
Silver#C0C0C0RGB(192,192,192)
Green#008000RGB(0,128,0)
Gray#808080RGB(128,128,128)
Black#000000RGB(0,0,0)

Example

<h1 style="background-color:silver;">SILVER</h1>
<h1 style="background-color:gray;">GRAY</h1>
<h1 style="background-color:black;">BLACK</h1>
<h1 style="background-color:green;">GREEN</h1>

HTML Text Color

Background of the browser is ‘white’ and the color of the text is also ‘black’ by default.

You can change it. You can set the color of text:

Example

<h4 style="color:green;">Hello World, This is demo.</h4>
<p style="color:red;">This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text.</p>

Hello World, This is demo.

This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text.

HTML Background Color

You can use background color or img in HTML elemant.

Example 1

<p style="background-color:red;">This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text.</p>

Output

This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text.

Example 2

<p style="background-color:#83B735;">This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text.</p>

Output

This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text.

HTML Border Color

You can use border color in HTML elemant.

Example

<h3 style="border:2px solid DodgerBlue;">Hello World, This is border example. Web development is the work involved in developing a web site for the Internet or an intranet. Web development can range from developing a simple single static page of plain text to complex web-based internet applications, electronic businesses, and social network services.</h3>

Output

Hello World, This is border example. Web development is the work involved in developing a web site for the Internet or an intranet. Web development can range from developing a simple single static page of plain text to complex web-based internet applications, electronic businesses, and social network services.