04.06.2013 Views

Head First HTML with CSS

Head First HTML with CSS

Head First HTML with CSS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

understanding hex codes<br />

The two minute guide to hex codes<br />

The first thing you need to know about hex codes is that they aren’t based on ten<br />

digits (0 to 9) – they’re based on 16 digits (0 to F). Here’s how hex digits work:<br />

1<br />

0<br />

2<br />

3<br />

4<br />

370 Chapter 9<br />

5<br />

6<br />

7 8<br />

9<br />

A<br />

10<br />

B<br />

11<br />

C<br />

12<br />

D<br />

13<br />

E<br />

14<br />

15<br />

F<br />

So if you see a hex number like B, you know that just means 11. But, what does BB,<br />

or E1, or FF mean? Let’s disassemble a hex color and see what it actually represents.<br />

In fact, here’s how you can do that for any hex color you might encounter.<br />

Step one:<br />

Separate the hex color into its three components.<br />

Remember that each hex color is made up of a red, green and blue component.<br />

The first thing you want to do is separate those.<br />

# CC66 00<br />

Red<br />

CC<br />

Green<br />

66<br />

Blue<br />

00<br />

Using hex, you only need a single<br />

digit to count all the way from<br />

0 to 15. When you get above 9,<br />

you start using letters.<br />

Take your hex color and<br />

break it up into its red,<br />

green, and blue components.

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

Saved successfully!

Ooh no, something went wrong!