Web design creating cool web sites with html, xhtml, and css

Page 93

66

Creating Cool Web Sites with HTML, XHTML, and CSS

Text Formatting with CSS You’ve looked at the skeleton of CSS long enough; it’s time to dig into some specifics of CSS formats and styles! To parallel Chapter 3, I start with basic text transformations: bold, italics, colors, sizes, and typefaces.

Bold text The most straightforward of the CSS visual text formatting styles is bold, which is specified as font-weight. As with all CSS tags, you can define a variety of possible values: • lighter • normal • bold • bolder You can specify the weight of the font in increments of 100, in the range of 100–900, with 100 being the lightest and 900 being the heaviest. Normal text is weight 500, and normal bold is 700. Specifying font-weight: 900 is the equivalent of extra-bold or, in the parlance of CSS, bolder.

Italics Italics are easier to work with than bold. You simply specify a font-style and pick from one of the following values: • normal • italics • oblique

note

Oblique font style is similar to italics, but more slanted. On a Web page, however, it looks identical to italics.

Why have a value for normal? Answering this question reveals the secret magic of the cas­ cading of style sheets. Imagine the following: <div style=”font-style: italics”> This is a paragraph where all the words should be italicized. But what if I have a word that I don’t want in italics? </div>


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.