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.

Using an online color chart<br />

You’ll also find some useful color charts on the<br />

Web. These charts typically display Web colors<br />

that are arranged according to a number of<br />

different criteria <strong>with</strong> their corresponding hex<br />

code. Using these colors is as easy as choosing<br />

the colors you want in your page and copying<br />

the hex codes into your <strong>CSS</strong>.<br />

This chart is maintained by the wikipedia<br />

at http://en.wikipedia.org/wiki/Web_colors<br />

You’ll also find many others by searching<br />

for “<strong>HTML</strong> color charts”.<br />

there are no<br />

Make sure you use the hex<br />

code for your colors, not the<br />

decorative name, which isn’t likely<br />

to be supported across browsers.<br />

Dumb Questions<br />

Q: I heard that if I don’t use Web-safe<br />

colors, my pages will never look right on<br />

other browsers. Why haven’t we talked<br />

about Web-safe colors?<br />

A: Back in the early days of Web<br />

browsers, few people had computer screens<br />

that supported a lot of colors, so the<br />

Web-safe palette of colors was created to<br />

ensure that pages looked consistent on most<br />

displays.<br />

Today the picture has changed drastically<br />

and most Web users have computer<br />

displays that support millions of colors. So,<br />

unless you have a special set of users that<br />

you know have limited color displays, you<br />

can pretty much count “Web-safe colors” as<br />

a thing of the past.<br />

Q: I know how to specify colors now,<br />

but how do I choose font colors that work<br />

well together?<br />

A: It would take an entire book to<br />

answer that question properly, but there<br />

are some basic guidelines to selecting<br />

font colors. The most important is to use<br />

colors <strong>with</strong> high contrast for the text and the<br />

background to aid readability. For instance,<br />

black text on a white background has the<br />

highest contrast. You don’t always have to<br />

stick <strong>with</strong> black and white, but do try to use<br />

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

a dark hue for the text, and a light hue for<br />

the background. Some colors, when used<br />

together, can create strange visual effects<br />

(like blue and orange, or red and green),<br />

so try your color combinations out on some<br />

friends before launching them on the world.<br />

Q: I’ve seen hex codes like #cb0;<br />

what does that mean?<br />

A: You’re allowed to use shorthand<br />

if each two-digit pair shares the same<br />

numbers. So, for instance, #ccbb00 can<br />

be abbreviated #cb0, or #11eeaa as #1ea.<br />

However, if your hex code is something like<br />

#ccbb10, then you can’t abbreviate it.<br />

you are here 373

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

Saved successfully!

Ooh no, something went wrong!