HTML Colors

HTML Colors

Colors are used to add look and feel to a web page. They are specified for the whole web page in the <body> tag or in individual tags to color them.

The <body> tag uses following attributes to set different colors

  • bgcolor: It is for the background of the page.
  • text: It is for the body text.
  • alink: It is for active links or selected links.
  • link: It is for linked text.
  • vlink: It is for visited links or which had been clicked.

Now CSS is used to customize the color instead of above attributes.

Color Coding Methods

HTML uses three methods to identify colors in a web page and which are

  • Color names: You can specify color names directly like green, blue or red.
  • Hex codes: A six-digit code representing the amount of red, green, and blue that make up the color.
  • Color decimal or percentage values: : This value is specified using the rgb( ) property.

Color Names – A color name is given to different colors and 16 basic color names are listed and standardized by W3C even though there are over 200 different color names. Standard 16 Colors are Black, Gray, Silver, White, Yellow, Lime, Aqua, Fuchsia, Red, Green, Blue, Purple, Maroon, Olive, Navy and Teal

Hex Codes – It uses a hexadecimal which is a 6 digit, representing a color. The first two digits indicate a red (RR) value, the next is for a green value (GG), and the last for blue value(BB). Various graphics software gives a hexadecimal value like Adobe Photoshop, Jasc Paintshop Pro.

Hexadecimal code is preceded by a hash sign (#) some examples are

Black – #000000, Red – #FF0000, Green – #00FF00, Blue – #0000FF and white – #FFFFFF

RGB Values – It uses the rgb( ) property by taking three values, one each for red, green, and blue. The value for each can be an number between 0 and 255 or a percentage. But all browsers does not support it so it is not widespread. Few examples are

Black – rgb(0,0,0), Red – rgb(255,0,0), Green – rgb(0,255,0), Blue – rgb(0,0, 255) and white – rgb(255,255,255)

Apply for HTML5 Certification Now!!

http://www.vskills.in/certification/Certified-HTML5-Developer

Back to Tutorial

Miscellaneous
Styles in HTML

Get industry recognized certification – Contact us

keyboard_arrow_up
Open chat
Need help?
Hello 👋
Can we help you?