04.06.2013 Views

Head First HTML with CSS

Head First HTML with CSS

Head First HTML with CSS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Step two:<br />

Convert each hex number into its decimal equivalent.<br />

Now that you have the components separated you can compute the value for<br />

each from 0 to 255. Let’s start <strong>with</strong> the hex number for the red component:<br />

Now take the left-most<br />

number and convert it to<br />

its decimal value, and also<br />

multiply it by 16.<br />

CC<br />

12<br />

Take the right-most<br />

number and write down<br />

its decimal value.<br />

12 * 16 = 192<br />

Finally, add these two<br />

numbers together. 192 + 12 = 204<br />

Step three:<br />

Now do this for the other two values.<br />

Repeat the same method on the other two values. Here’s what you should get:<br />

Step four:<br />

CC 66 00<br />

204 102 0<br />

There is no step four, you’re done!<br />

That’s it. Now you’ve got the numbers for each component and you know<br />

exactly how much red, green, and blue go into the color. You can disassemble<br />

any hex color in exactly the same way. Now let’s see how you’ll usually<br />

determine Web colors.<br />

styling <strong>with</strong> fonts and colors<br />

So 204 is the decimal<br />

equivalent of CC in hex.<br />

To calculate 66, you have<br />

(6 * 16) + 6 = 102<br />

To calculate 00, you have<br />

(0 * 16) + 0 = 0<br />

you are here 371

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!