How to use HTML & CSS Color Codes!


Staff member
With HTML color codes you can set the color of your websites background, color of the text, cells in tables and much more.

Using HTML color codes for web site background color:
<body style="background:#1C1C1C">

Using HTML color codes for setting font/text color:
<span style="color:#1C1C1C">

Using HTML color codes for table background color:
<table style="background:#1C1C1C">

Using HTML color code for link color:
<a style="color:#1C1C1C">



Using CSS for web site background color:

Using CSS for text color:

So you are wondering "Does this weird combination of letters and numbers have any meaning?" Well the answer is "Yes" and this is how it goes:)

HTML Codes format:
Each HTML code contains symbol "#" and 6 letters or numbers. These numbers are in hexadecimal numeral system. For example "FF" in hexadecimal represents number 255 in Decimal.

Meaning of symbols:
The first two symbols in HTML color code represents the intensity of red color. 00 is the least and FF is the most intense. The third and fourth represents intensity of green and fifth and sixth represents the intensity of blue. So with combining the intensity of red, green and blue we can mix almost any color that our heart desire;)

#FF0000 - With this HTML code we tell browser to show maximum of red and no green and no blue. The result is of course pure red color:

#00FF00 - This HTML code shows just green and no red and blue. The result is:

#0000FF - This HTML code shows just blue and no red and green. The result is:

#FFFF00 - Combination of red and green color gives us yellow:

#CCEEFF - Take some red a bit more of green and maximum of blue to get color of sky:


New member
Mostly HTML is used in note pad. We use to make classes of java, Buttons, website symbols and other things. We use main method to make these all things.


CSS also allow you to write the colours as decimal numbers. Instead of writing #CCEEFF you can write rgb(204, 238, 255).

I normally prefer the hexadecimal notation (#CCEEFF) but the rgb notation can be useful in combination with JavaScript because it makes it easier to control the colour components (red, green, blue) using variables.

There are also many predefined colour names that can be used.


New member
in css we can use Hexadecimal color code, RGB color code, RGBA color code, HSL color code, HSLA color code and color name.

background-color: red;
background-color: #ff0000; <--this red background
background-color: rgb(255,0,0); <--this red background
background-color: rgba(255,0,0,0.3); <--this red background with opacity
background-color: hsl(120,100%,50%); <-- green
background-color: hsla(120,100%,50%,0.3); <-- green with opacity


Good guide! One thing I've found helpful is to get image picker software which supports hex codes, then I can mouse over anything and use that color. :)