HTML5, CSS3, and JavaScript Fourth Edition

(Ben Green) #1

CHAPTER 9. CSS: THE STYLE SHEET 93


Required Answer:color:


To style all

headers with green lettering on a pink background, we
could use this style directive.


h1 { color: green; background-color: pink; }


9.5 font-size:


We can control the size of our lettering by using thefont-size:attribute.


Exam Question 165(p.346): What CSS attribute: sets the size of your
lettering?
Required Answer:font-size:


Note thattext-size:isnota CSS attribute. Usefont-size:instead.


To make all level-two headings twice as big as ordinary text, we could use
the following directive.


h2 { font-size: 200%; }


font-size: can be measured in many different ways, including points. To
make all bold text appear in 24-point size, we could use the following direc-
tive.


b { font-size: 24pt; }


As you will remember, there are 47 points in one central degree of vision,
and 96 points equals one inch held at arm’s length. Commonly font sizes
of 9pt or 10pt are used in books, with about 72pt per inch on the printed
page.


Old-style HTML might show things like. The old style is
deprecated. Do not use it.


9.6 font-weight: (normal, bold)


font-weight:can be normal, bold, or an x-hundred number like 100, 200,
..., 900. The smaller the number, the lighter the weight.


Exam Question 166(p.346): What CSS attribute: sets the thickness of
your lettering?
Required Answer:font-weight:

Free download pdf