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.

Changing a font’s weight<br />

The font-weight property allows you to control<br />

how bold the text looks. As you know, bold text looks<br />

darker than normal text and tends to be a bit fatter too.<br />

You can make any element use bold text by setting the<br />

font-weight property to bold, like this:<br />

font-weight: bold;<br />

You can also go the other way. If you have an element<br />

that is set to bold by default, or is inheriting bold from a<br />

parent, then you can remove the bold style like this:<br />

font-weight: normal;<br />

There are also two relative font-weight properties:<br />

bolder and lighter. These will make your text<br />

style a little bolder or a little lighter relative to its<br />

inherited value. These values are seldom used and<br />

because not many fonts allow for slight differences in<br />

the amount of boldness, in practice these two values<br />

often have no effect.<br />

You can also set your font-weight property to a<br />

number between 100 and 900, but again, this is not<br />

well supported across fonts and browsers and so is<br />

not often used.<br />

Sharpen your pencil<br />

font-weight: normal;<br />

font-weight: bold;<br />

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

Starbuzz Coffee<br />

Beverages<br />

Starbuzz Coffee<br />

Beverages<br />

Write the <strong>CSS</strong> to change the headings in Tony’s page from their default bold value to<br />

normal weight. Then, add the rule to your <strong>CSS</strong> and give it a test drive. You’ll find the<br />

answer to this one on the next page.<br />

you are here 359

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

Saved successfully!

Ooh no, something went wrong!