HTML and CSS Reference
In-Depth Information
As you know, the RGB system of assigning integers to color values uses values from 0 to 255.
Using hexadecimal values, you need only two digits (actually, hexadecimal integers) to
represent all 256 values in an 8-bit byte. It's neater.
h is leads to using hexadecimal integers in assigning color values. Using six values — two
each for red, green, and blue — all the color values can be assigned using six hex integers. So
returning to the value 6F001C , we can see the following:
Red: 6F
Blue: 00
Green: 1C
Getting used to hexadecimal can take some time, but once you do, it's easy to add color values
with them. Also, you can understand them in the same way as RGB decimal integers, but
instead of values of 0 to 255, you use 00 to FF. h e following example ( HexPalette.html
in this chapter's folder at www.wiley.com/go/smashinghtml5 ) shows some color using
hexadecimals.
<! DOCTYPE HTML >
< html >
< head >
< style type = ”text/css” >
/* Palette -- only use these colors!
69675C, 69623D, ECE8CF, E8D986, B5AA69
gray, olive, cream, dark cream, khaki */
body {
font - family : ”Comic Sans MS” , cursive ;
background - color : #ECE8CF;
color : #69675C;
}
h1 {
font - family : ”Arial Black” , Gadget , sans - serif ;
color : #B5aa60;
background - color : #E8D986;
text - align : center ;
}
h2 {
font - family : ”Lucida Sans Unicode” , “Lucida Grande” , sans - serif ;
color : #b5aa69;
}
</ style >
< meta http - equiv = ”Content-Type” content = ”text/html; charset=UTF-8” >
< title > Hexadecimal with Palette </ title >
</ head >
< body >
< h1 > Style with a Color Palette </ h1 >
< h2 >& nbsp ; Desert in the Fall </ h2 >
In the fall , when the air cools a bit , the desert begins to settle down and cloak
73
 
Search WWH ::




Custom Search