HTML COLORS

HTML colors are specified using predefined color names, or with RGB, HEX, HSL, RGBA, or HSLA values.

Color Names

In HTML, a color can be specified by using a color names.

Orange

SlateBlue

Purple

Color Values

In HTML, colors can also be specified using RGB values, HEX values, HSL values, RGBA values, and HSLA values.

<h1 style=”background-color:rgb(255, 43, 90);”></h1>
<h1 style=”background-color:#ff6347;”></h1>
<h1 style=”background-color:hsl(9, 100%, 54%);”></h1>

<h1 style=”background-color:rgba(255, 99, 71, 0.5);”></h1>
<h1 style=”background-color:hsla(9, 100%, 64%, 0.5);”></h1>

rgb(255, 43, 90)

#20DA77

hsl(9, 100%, 54%)

rgba(47, 15, 255, 0.7)

hsla(344, 100%, 64%, 0.5)

Background Color

We can set the background color for HTML elements:

<h1 style=”background-color:green;”>Hello World!!!</h1>
<p style=”background-color:yellow;”>This is a Paragraph</p>

Hello World!!!

This is a Paragraph

Text Color

We can set the color of text.

<h1 style=”color:slateblue;”>Hello World</h1>
<h2 style=”color:orange;”>Heading2</p>
<p style=”color:DodgerBlue;”>Learn the basics of coding</p>

Hello World

Heading2

Learn the basics of coding

Border Color

You can set the color of borders:


<h1 style=”border:3px solid green;”>Hello World</h1>
<h1 style=”border:3px solid DodgerBlue;”>Hello World</h1>
<h1 style=”border:3px solid orange;”>Hello World</h1>

Hello World

Hello World

Hello World

DOWNLOAD LATEST PROJECTS

Border Color