Javatpoint Logo
Javatpoint Logo

HTML Color Tag

Introduction

With the help of color, we can provide a good look for any thing. So with the help of color we can give a good look to the website. Inside the body tag we can specify some color, which will applied to the whole website.

With the help of following tag we can provide the color property to the web page. these are as follows.

  • Bgcolor: with the help of this attribute we can set the color for the background of a web page.
  • Text: with the help of this attribute we can specify the color for the body text.
  • Alink: with the help of this attribute we can set the color for the active links or selected links.
  • Link: with the help of this attribute we can set the color for linked text.
  • Vlink: with the help of this attribute we can set the color for visited links - that is, for linked text that you have already clicked on.

HTML Color Coding Methods

In the webpage we can implement the color with the help of three method. Those three method are as follows.

  • Color names: In the HTML, we can implement the color with the help of color name like green, blue or red.
  • Hex codes: In the HTML, we can implement the color with the help of A six-digit code representing the amount of red, green, and blue.
  • Color decimal or percentage values: In the HTML, we can implement the color with the help of value is specified using the rgb( ) property.

HTML Colors - Color Names

With the help of HTML color name we can also set the background or text color. These color names are easier to remember and use in your HTML and CSS code. Here is a list of some of the most commonly used color names in HTML:

  1. Black: black
  2. White: white
  3. Red: red
  4. Green: green
  5. Blue: blue
  6. Yellow: yellow
  7. Purple: purple
  8. Orange: orange
  9. Pink: pink
  10. Gray: gray or grey
  11. Brown: brown

Lets understand this by taking an example.

Example 1:

Output:

HTML Color Tag

Explanation:

In the above code we are using color name for the coloring of the text. Here we use green color for the body and white color for the text that is written in the body.

Limitation of using color name in the HTML code:

If we use color name in the HTML code, we are unable say which color is by looking the name of the color. For example if we guess that the color name is purple but actually that color is the pure hue between the magneta and blue. But actually it is different from the dark magneta.

HTML Colors - Hex Codes

The hex code for the colors contains 6 digit code. The first two digit of the color code represent the red color, then the next two digit code for the color represent the value for the green color and the last two digit represents the code for the value for blue color.

We can take the hex value of the color code from any graphis software like Adobe Photoshop, Paintshop Pro or MS Paint.

In the hex value, each code for the color name preceded by a pound or hash sign #. Below are the list of color name along hex code value.

Color name Hex code
black #000000
Silver #C0C0C0
Grey #808080
White #FFFFFF
Maroon #800000
Red #FF0000
Purple #800080
Fuchsia #FF00FF
Green #008000
Lime #00FF00
Olive #808000
Yellow #FFFF00
Navy #000080
Blue #0000FF
Teal #008080
Aqua #00FFFF
Alice blue #f0f8ff
Antique white #faebd7
Aqua #00ffff
Aquamarine #7fffd4
Azure #f0ffff
Beige #f5f5dc
black #000000
Blanched almond #ffebcd
blue #0000ff
Blue violet #8a2be2
Brown #a52a2a
Burly wood #deb887
Cadet blue #5f9ea0
Chartreuse #7fff00
Chocolate #d2691e
Coral #ff7f50
Cornflower blue #6495ed
Corn silk #fff8dc
Crimson #dc143c
Cyan #00ffff
Dark blue #00008b
Dark cyan #008b8b
Dark goldenrod #b8860b
Dark gray #a9a9a9
Dark green #006400
Dark grey #a9a9a9
Dark khaki #bdb76b
Dark magenta #8b008b
Dark olive green #556b2f
Dark orange #ff8c00
Dark orchid #9932cc
Dark red #8b0000
Dark salmon #e9967a
Dark sea green #8fbc8f
Dark slate blue #483d8b
Dark slate gray #2f4f4f
Dark turquoise #00ced1
Dark violet #9400d3
Deep pink #ff1493
Deep sky blue #00bfff
Dim grey #696969
Dodger blue #1e90ff
Fire brick #b22222
Flora white #fffaf0
Forest green #228b22
Fuchsia #ff00ff
Gains boro #dcdcdc
Ghost white #f8f8ff
Gold #ffd700
Golden rod #daa520
Gray #808080
green #008000
Green yellow #ffffe0
Lime #00ff00
Lime green #32cd32
Linen #faf0e6
Magenta #ff00ff
Maroon #800000
Medium aqua marine #66cdaa
Medium blue #0000cd
Medium orchid #ba55d3
Medium purple #9370db
Medium sea green #3cb371
Medium slate blue #7b68ee
Medium spring green #00fa9a
Medium turquoise #48d1cc
Medium violetred #c71585
Midnight blue #191970
Mint cream #f5fffa
Misty rose #ffe4e1
Moccasin #ffe4b5
Navajo white #ffdead
Navy #000080
Old lace #fdf5e6
Olive #808000
Olive drab #6b8e23
Orange #ffa500
Orange red #ff4500
Orchid #da70d6
Pale golden rod #eee8aa
Pale green #98fb98
Pale turquoise #afeeee
Pale violetred #db7093
Papaya whip #ffefd5
Peach puff #ffdab9
Peru #cd853f
Pink #ffc0cb
Plum #dda0dd
Powder blue #b0e0e6
Purple #800080
Red #ff0000
Rosy brown #bc8f8f
Royal blue #4169e1
Saddle brown #8b4513
Salmon #fa8072
Sandy brown #f4a460
Sea green #2e8b57
Sea shell #fff5ee
Sienna #a0522d
silver #c0c0c0
Sky blue #87ceeb
Slate blue #6a5acd
Slate gray #708090
Snow #fffafa
Spring green #00ff7f
Steel blue #4682b4
Tan #d2b48c
Teal #008080
Thistle #d8bfd8
Tomato #ff6347
Turquoise #40e0d0
Violet #ee82ee
Wheat #f5deb3
White #ffffff
White smoke #f5f5f5
Yellow #ffff00
Yellow green #9acd32

Lets understand this by taking an example.

Example 2:

Output:

HTML Color Tag

Explanation:

In the above code we have take the help of hex code to provide the color property in the webpage.

HTML Colors - RGB Values

In HTML we can specify the color with the help of RGB value, by the help of below formule.

in the above formula each parameter define its intencity within the range 0 to 255.

For example if we take the color code for the red then its value become rgb(255, 0, 0). Here red is set to its highest value (255), and the other two (green and blue) are set to 0.

Note: we have to note one thing that all the browser does not support this RGB property. so it is not recommended to use.

Below are some of the list of code along with their RGB value.

Color name RGB Value
Maroon (128 , 0 ,0)
dark red (139 , 0 , 0)
Brown (165 , 42 , 42)
Fire brick (178 , 34 , 34)
Crimson ( 220 , 20 , 60)
Red ( 255 , 0 , 0 )
Tomato ( 255 , 99 , 71)
Coral ( 255 , 127 , 80 )
indian red ( 205 , 92 , 92 )
light coral ( 240 , 128 , 128 )
dark salmon ( 233 , 150 , 122 )
Salmon ( 250 , 128 , 114 )
light salmon ( 255 , 160 , 122 )
orange red ( 255 , 69 , 0 )
dark orange ( 255 , 140 , 0 )
Orange ( 255 , 165 , 0 )
Gold ( 255 , 215 , 0 )
dark golden rod ( 184 , 134 , 11 )
golden rod ( 218 , 165 , 32 )
pale golden rod ( 238 , 232 , 170 )
dark khaki ( 189 , 183 , 107 )
Khaki ( 240 , 230 , 140 )
Olive ( 128 , 128 , 0 )
Yellow ( 255 , 255 , 0 )
yellow green ( 154 , 205 , 50 )
dark olive green ( 85 , 107 , 47 )
olive drab ( 107 , 142 , 35 )
lawn green ( 124 , 252 , 0 )
Chartreuse ( 127 , 255 , 0 )
green yellow ( 173 , 255 , 47 )
dark green ( 0 , 100 , 0 )
Green ( 0 , 128 , 0 )
forest green ( 34 , 139 , 34 )
Lime ( 0 , 255 , 0 )
lime green ( 50 , 205 , 50 )
light green ( 144 , 238 , 144 )
pale green ( 152 , 251 , 152 )
dark sea green ( 143 , 188 , 143 )
medium spring green ( 0 , 250 , 154 )
spring green ( 0 , 255 , 127 )
sea green ( 46 , 139 , 87 )
medium aqua marine ( 102 , 205 , 170 )
medium sea green ( 60 , 179 , 113 )
light sea green ( 32 , 178 , 170 )
dark slate gray ( 47 , 79 , 79 )
Teal ( 0 , 128 , 128 )
dark cyan ( 0 , 139 , 139 )
aqua ( 0 , 255 , 255 )
Cyan ( 0 , 255 , 255 )
light cyan ( 224 , 255 , 255 )
dark turquoise ( 0 , 206 , 209 )
Turquoise ( 64 , 224 , 208 )
medium turquoise ( 72 , 209 , 204 )
pale turquoise ( 175 , 238 , 238 )
aqua marine ( 127 , 255 , 212 )
powder blue ( 176 , 224 , 230 )
cadet blue ( 95 , 158 , 160 )
steel blue ( 70 , 130 , 180 )
corn flower blue ( 100 , 149 , 237 )
deep sky blue ( 0 , 191 , 255 )
dodger blue ( 30 , 144 , 255 )
light blue ( 173 , 216 , 230 )
sky blue ( 135 , 206 , 235 )
light sky blue ( 135 , 206 , 250 )
midnight blue ( 25 , 25 , 112 )
Navy ( 0 , 0 , 128 )
dark blue ( 0 , 0 , 139 )
medium blue ( 0 , 0 , 205 )
Blue ( 0 , 0 , 255 )
royal blue ( 65 , 105 , 225 )
blue violet ( 138 , 43 , 226 )
Indigo ( 75 , 0 , 130 )
dark slate blue ( 72 , 61 , 139 )
slate blue ( 106 , 90 , 205 )
medium slate blue ( 123 , 104 , 238 )
medium purple ( 147 , 112 , 219 )
dark magenta ( 139 , 0 , 139 )
dark violet ( 148 , 0 , 211 )
dark orchid ( 153 , 50 , 204 )
medium orchid ( 186 , 85 , 211 )
Purple ( 128 , 0 , 128 )
Thistle ( 216 , 191 , 216 )
Plum ( 221 , 160 , 221 )
Violet ( 238 , 130 , 238 )
magenta / fuchsia ( 255 , 0 , 255 )
Orchid ( 218 , 112 , 214 )
medium violet red ( 199 , 21 , 133 )
pale violet red ( 219 , 112 , 147 )
deep pink ( 255 , 20 , 147 )
hot pink ( 255 , 105 , 180 )
light pink ( 255 , 182 , 193 )
Pink ( 255 , 192 , 203 )
antique white ( 250 , 235 , 215 )
Beige ( 245 , 245 , 220 )
Bisque ( 255 , 228 , 196 )
blanched almond ( 255 , 235 , 205 )
Wheat ( 245 , 222 , 179 )
corn silk ( 255 , 248 , 220 )
lemon chiffon ( 255 , 250 , 205 )
light golden rod yellow ( 250 , 250 , 210 )
light yellow ( 255 , 255 , 224 )
saddle brown ( 139 , 69 , 19 )
Sienna ( 160 , 82 , 45 )
Chocolate ( 210 , 105 , 30 )
Peru ( 205 , 133 , 63 )
sandy brown ( 244 , 164 , 96 )
burly wood ( 222 , 184 , 135 )
Tan ( 210 , 180 , 140 )
rosy brown ( 188 , 143 , 143 )
Moccasin ( 255 , 228 , 181 )
navajo white ( 255 , 222 , 173 )
peach puff ( 255 , 218 , 185 )
misty rose ( 255 , 228 , 225 )
lavender blush ( 255 , 240 , 245 )
Linen ( 250 , 240 , 230 )
old lace ( 253 , 245 , 230 )
papaya whip ( 255 , 239 , 213 )
sea shell ( 255 , 245 , 238 )
mint cream ( 245 , 255 , 250 )
slate gray ( 112 , 128 , 144 )
light slate gray ( 119 , 136 , 153 )
light steel blue ( 176 , 196 , 222 )
Lavender ( 230 , 230 , 250 )
floral white ( 255 , 250 , 240 )
alice blue ( 240 , 248 , 255 )
ghost white ( 248 , 248 , 255 )
honeydew ( 240 , 255 , 240 )
Ivory ( 255 , 255 , 240 )`
azure ( 240 , 255 , 255 )
Snow ( 255 , 250 , 250 )
Black ( 0 , 0 , 0 )
dim gray / dim grey ( 105 , 105 , 105 )
gray / grey ( 128 , 128 , 128 )
dark gray / dark grey ( 169 , 169 , 169 )
Silver ( 192 , 192 , 192 )
light gray / light grey ( 211 , 211 , 211 )
Gains boro ( 220 , 220 , 220 )
white smoke ( 245 , 245 , 245 )
White ( 255 , 255 , 255 )

Let us understand this by taking an example.

Example 3:

Output:

HTML Color Tag

Explanation:

In the above code, we have taken the help of RBG value to provide the colour property on the webpage.


Next TopicHTML Datalist





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA




news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news
news