You can set text and background colors with the style attribute (or better, in a CSS file).
Ways to write a color
- Name:
red,navy,tomato - HEX:
#ff6347— red, green and blue in hexadecimal - RGB:
rgb(255, 99, 71)— each value from 0 to 255 - RGBA:
rgba(255, 99, 71, 0.5)— the last value is transparency (0 to 1) - HSL:
hsl(9, 100%, 64%)— hue, saturation, lightness
All of these can describe the same color.
Example
Example — Text and background colors
HTML
<h2 style="color: navy;">Navy heading</h2>
<p style="color: #ff6347;">Tomato text using HEX</p>
<p style="background-color: rgb(255, 235, 59); padding: 8px;">Yellow background using RGB</p>
<p style="background-color: rgba(0, 128, 0, 0.3); padding: 8px;">See-through green using RGBA</p>