14. HTML Color

HTML Color

1.color values
2.16 million colors
3.web standard color names
4.color names supported by all browsers
5.web safe colors ?
6.shades of Gray

Color Values

HTML colors are defined using a hexadecimal(hex) notation for the combination of red,green,and blue(RGB)

the lowest value that can be given to one of the light source is 0 (hex 00).
the highest value is 255(hex FF)

Hex values are written as 3 double-digit numbers, starting with a #sign, such as #9ACD32

<html>
<body>
<p style="background-color:#C0C0C0">
Color set by using hex values
</p>
<p style="background-color:rgb(192,192,192)">
Color set by using rgb values
</p>
<p style="background-color:gray">
Color set by using color name
</p>
</body>
</html>

16 million different colors

256x256x256 gives more than 16 million colors to display
monitors are capable of displaying atleast 16,384 colors

Web Standard color names

The Word Wide Web Consortium (W3C) has listed 16 valid color names for HTML and CSS

Aqua
Black
Blue
Fuchsia
Gray
Green
Lime
Maroon
Navy
Olive
Purple
Red
Silver
Teal
White
Yellow

If you want to use other colors, you should specify their HEX values

Color Names Supported by All Browsers

a collection of nearly 150 color names are supported by all major browsers
for more info http://www.w3schools.com/html/html_colornames.asp

if you want valid HTML or CSS, use the HEX values instead.

Web Safe Colors ?

Some years ago, when computers supported a maximum of 256 different colors, a list of 216 "web safe colors" was suggested as a web standard, reserving 40 fixed system colors.
This cross-browser color palette was created to ensure that all computers would display the colors corrently when running a 256-color palette.

Shades of Gray

Gray colors are displayed using an equal amount of power to alll of the light sources.
for more info visit http://www.w3schools.com/html/html_colors.asp.

No comments:

My Favorite Books

  • C and Data Structures by Ashok N. kamthane
  • Web Technologies by A. A. Puntambekar
  • Learn HTML and CSS with W3Schools
  • Learn JavaScript and Ajax with W3Schools
  • HTML5 Black Book: Covers Css3, Javascript,XML, XHTML, Ajax, PHP And Jquery
  • HTML5 Application Development Fundamentals: MTA Exam 98-375
  • .NET 4.0 Programming 6-In-1, Black Book
  • SQL Server 2008 R2 Black Book
  • Asp.net 4.0 Projects Covers: net 3.5 And .net 4.0 Codes, Black Book
  • UNIX Shell Programming 1 Edition by Yashavant Kanetkar
  • UNIX and Shell Programming 1 Edition by Richard F. Gilberg, Behrouz A. Forouzan
  • Computer Networks by Andrew S. Tanenbaum
  • Multiple Choice questions in computer science by Timothy J Williams