HTML Code for Colors
HTML 4.01 transitional allows you to use the color attribute to specify colors for text and the bgcolor attributes to specify background colors for the document body and table cells.
Using HTML code for colors is now deprecated - colors should be specified via Cascading Style Sheets (CSS).
CSS provides the color property and the background-color properties, both of which can be applied to any HTML element. And there's the border-color and outline-color properties for borders and outlines. You can also specify color for borders with the border property (which allows you to set all border properties in one go), and likewise for outlines with the outline property.
Colors can be defined using either its color name, its hexadecimal value, or its rgb value.
Examples of Setting Color using Inline Styles:
You can also check out the hex color codes page to learn about colors in HTML and CSS.