In this lesson we will use inline styling with CSS properties color and background-color to change the text color and/or background color of HTML Elements.




WHat are Html colors codes?

HTML Colors:


HTML Colors define colors that we see on a web page.

In this lesson we will use inline styling with CSS properties color and background-color to change the text color and/or background color of HTML Elements.

HTML Colors can be defined using the following:

• Color Name. 

It defines any valid color by its color name e.g. white, black.

• Hex Color Value. Or Hexadecimal Color Value. 

It defines any valid color by a hash followed by letters and/or numbers e.g. #ffffff, #000000 .

• RGB Color Value. 

RGB stands for Red, Green, Blue. It defines any valid color by this format" rgb(number, number, number) "e.g. rgb(255, 255, 255), rgb(0, 0, 0). The numbers represent the intensity of the red, green and blue colors in that particular order.

Most common Html example:





For Red:

 <div style="color: red;">This text is red</div>

For Blue: 

<div style="color: blue;">This text is blue</div>

For Green:

<div style="color: green;">This text is green</div>

For Yellow:

 <div style="color: yellow;">This text is yellow</div>


For Purple:

 <div style="color: purple;">This text is purple</div>

For Orange:

 <div style="color: orange;">This text is orange</div>

For Pink:

 <div style="color: pink;">This text is pink</div>

For Black:

 <div style="color: black;">This text is black</div>

For White: 

<div style="color: white;">This text is white</div>

For Gray: 

<div style="color: gray;">This text is gray</div>

Output:

Output

Most common Html color

Html color list

List of color

Difference between html and hexadecimal color:


Html color:

HTML color refers to the color that can be applied to elements on a web page using HTML and CSS. It can be specified using a variety of formats, including keywords (e.g. "red", "blue"), RGB values (e.g. "rgb(255, 0, 0)"), and HEX values (e.g. "#ff0000").

Hexadecimal color:

HEX color, on the other hand, is a specific format for specifying color in HTML and CSS. It is a six-digit code that represents the values of the red, green, and blue components of a color. The code begins with a hash symbol (#) and is followed by two characters for each component (e.g. #ff0000 is red, #00ff00 is green, #0000ff is blue).