HTML colors are specified with predefined color names, or with RGB, HEX, HSL, RGBA, or HSLA values.
In HTML, Red, green, and blue are represented in HTML by the hexadecimal triplets #RRGGBB. Red, for instance, has the color code #FF0000, which is composed of '255' red, '0' green, and '0' blue. On a 24-bit display, all 16,777,216 potential HTML color codes are accessible.
EXAMPLE:
<!DOCTYPE html>
<html>
<body>
<h1 style="background-color:Tomato;">Tomato</h1>
<h1 style="background-color:Orange;">Orange</h1>
<h1 style="background-color:DodgerBlue;">DodgerBlue</h1>
<h1 style="background-color:MediumSeaGreen;">MediumSeaGreen</h1>
<h1 style="background-color:Gray;">Gray</h1>
<h1 style="background-color:SlateBlue;">SlateBlue</h1>
<h1 style="background-color:Violet;">Violet</h1>
<h1 style="background-color:LightGray;">LightGray</h1>
</body>
</html>
You can set the background color for HTML elements:
EXAMPLE:
<!DOCTYPE html>
<html>
<body>
<h1 style="background-color:DodgerBlue;">Let's play dodgerball! Mate!</h1>
<p style="background-color:Tomato;">
I Love Tomatoes, Do you love tomatoes as well?
</p>
</body>
</html>
We use the style attribute to set the font color in HTML. The style attribute specifies an inline style for an element, with the CSS property color. The attribute is used with the HTML <p> tag, with the CSS property color. HTML5 do not support the <font> tag, so the CSS style is used to add font color.
EXAMPLE:
<!DOCTYPE html>
<html>
<body>
<h3 style="color:FireBrick;">Move! Move! Move!</h3>
<p style="color:Chartreuse;">Mr. Arias, I have a very important appointment today.</p>
<p style="color:Crimson;">Finally, my power has exceeded 9000!</p>
</body>
</html>
The borderColor property sets or returns the color of an element's border. This property can take from one to four values: One value, like: p {border-color: green} - all four borders will be green.
EXAMPLE:
<!DOCTYPE html>
<html>
<body>
<h1 style="border: 2px solid Tomato; color:White;">This is how border works</h1>
<h1 style="border: 2px solid DodgerBlue; color:ForestGreen;">With this you can mix it with color</h1>
<h1 style="border: 2px solid Purple; color:Indigo; background-color:SlateGrey;">And a badass background</h1>
</body>
</html>