
HTML
HTML Head
HTML Forms
HTML Graphics
HTML Media
HTML APIs
HTML Colors
The HTML colors are predefined color codes or names that determine the color of the text, background, text borders, etc. All the HTML colors have a specific name, hexadecimal codes, and RGB, RGBA, HSL, and HSLA values that create the various visual styles as per requirement.
Color Names
You can specify a color in an HTML document by writing the color name.
Background Color
In an HTML document, you can easily set the background to any color.
Text Color
The color of the text can also be changed to required color.
Border Colors
Similarly, the borders can also be colored into any color in the HTML.
HTML Color Values
In HTML, the colors are specified with hexadecimal triplet values. These include the basic colors red, green, and blue. You can create any color using these primary colors. To create colors in HTML RGB, RGBA, HEX, HSL, and HSLA values are used.
- HEX: #ff5733
- RGB: rgb(0, 255, 0)
- RGBA: rgba(0, 0, 255, 0.5)
- HSL: hsl(120, 100%, 75%)
- HSLA: hsla(240, 100%, 50%, 0.7)
These color codes are used to change text color, color of the background, border, tables, and other elements of the webpage.
You can use a reference color code chart to create a particular color. Every color has a unique code and can be used in HTML easily. For red color, you will use the code red in HTML and CSS, instead of its code #FF0000 because HTML supports adding colors using their names.