HTML Colors

Predefined colour names or RGB, HEX, HSL, RGBA, or HSLA values are used to specify colours in HTML.

In CSS3, RGBA and HSL/HSLA colours are introduced. Red, green, and blue (RGB) were the only colours we used before to CSS2. Screen colours RGB and RGBA are not suggested for printing. There are 16 million different colours in RGB altogether. CSS3 does, however, also support RGBA, HSL, and HSLA colours. Hue, Saturation, and Lightness, or HSL

Prior to CSS3, only RGB colours were used. The RGB or Hexadecimal formats are used to declare RGB colours. Red, for instance, is represented as red, rgb(255,0,0), #ff0000, and #f00.

Try Our Color Picker

 

Colour Names

A colour name can be used to specify a colour in HTML:

Names of Colours List
White Black Orange Maroon
Red Yellow Lime green Salmon
Green Sky blue Crimson Aqua
Grey Purple Mustard Peach
Violet Magenta Coral Saffron
Brown Pink Tan Teal
Navy Blue Turquoise Lavender Beige
Lemon yellow Grape vine Indigo Fuchsia
Amber Sea green Dark green Burgundy
Charcoal Bronze Cream Mauve
Olive Cyan Silver Rust
Ruby Azure Mint Pearl
Ivory Tangerine Cherry red Garnet
Emerald Sapphire Rosewood Lilac
Arctic blue Pista green Coffee brown Umber
Brunette Mocha Ash Jet black

There are 140 recognised colour names in HTML.

For HTML elements features

You can set the background colour
You can modify the text\’s colour.
You can customise the border colour.

Similar to RGB colours, RGBA colours also include an additional fourth value called Alpha. Color opacity is measured by alpha. Hence, the colour solid red can alternatively be expressed as rgba (255, 0, 0, 1). But, RGBA colour is required if we wish to add transparency to the red colour. Always a floating number, the alpha value ranges from 0 to 1, for example, rgba(255,0,0,0.5) is red with 50% transparency. Alpha value for dark(solid) colours is 1. Alpha value is 0 for complete transparency. Alpha values for semi-transparent colours can also change. Alpha values of 0.25 and 0.75 denote 25% and 75% transparency, respectively.

An summary of colour specification techniques:

English name, for example, white
RGB colour code in hexadecimal, for example: #ff0000
Soft colours have the hexadecimal RGB value of #f00.
RGB values in decimal form, such as: rgb (255, 0, 0)
RGBA value in decimal form, for example: rgba (255, 0, 0, 0.2)
A color\’s HSL value is hsl(120, 100%, 50%).
Color is an example of an HSLA value: hsla(0, 100%, 50%, 0.5).

Furthermore, RGB, HEX, HSL, RGBA, and HSLA values can be used in HTML to specify colours.

Color Full-Form CSS Version
RGB Red Green blue CSS2
RGBA Red Green Blue Alpha CSS3
HSL Hue Saturation Lightness CSS3
HSLA Hue Saturation Lightness Alpha CSS3

Example

<!DOCTYPE html>
<html>
<body>

<h1>Color Example</h1>

<h2 style=\”background-color:red;\”>red</h2 >
<h2 style=\”background-color:rgb(255, 199,171);\”>rgb(255, 199, 171)</h2 >
<h2 style=\”background-color:#ff0000;\”>#ff0000</h2 >
<h2 style=\”background-color:hsl(9, 100%, 64%);\”>hsl(7, 100%, 64%)</h2 >

<h1>Color Example but 50% transparent:</h1>

<h2 style=\”background-color:rgba(255, 199, 171, 0.5);\”>rgba(255, 99, 71, 0.5)</h2 >
<h2 style=\”background-color:hsla(8, 100%, 94%, 0.5);\”>hsla(7, 100%, 64%, 0.5)</h2 >

 

</body>
</html>

Output

\"Html

HTML color name with hex code (A to Z) list
Related Posts
Introduction to HTML

HTML Introduction HTML is the most common language used to mark up Web pages. What does HTML mean? Hyper Text Read more

What is HTML

HTML stands for Hyper Text Markup Language, which is a programming language used to make web pages and web apps. Read more

HTML Basic Examples

In this chapter, we\'ll show you some simple examples of HTML code. Don\'t worry if we use tags that you Read more

HTML text Editors

Editors for HTML text HTML files are text files, so any text editor can be used to make them. Text Read more

HTML Tags

Learn HTML Tags HTML tags are kind of like keywords that tell a web browser how to format and show Read more

HTML Elements

Elements make up an HTML file. These elements are what make web pages and tell you what content is on Read more

HTML Attributes

Attribute in HTML Attributes in HTML are special words that tell you more about an element. Attributes change the way Read more

HTML Headings

Headings in HTML The <h1> to <h6> tags are used to set up headings in HTML. <h1> shows which heading Read more

Scroll to Top