HTML colors are specified using predefined color names, or with RGB, HEX, HSL, RGBA, or HSLA values.
In HTML, a color can be specified by using a color names.
Orange
SlateBlue
Purple
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>
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>
This is a Paragraph
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>
Learn the basics of coding
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>