Transforming and Varying TextYou can style the case of text and vary its font using two different properties. To transform case, you use the text-TRansform property and a value of capitalize, uppercase, lowercase, or none. To vary text, you use the font-variant property and a value of small-caps or normal (which is the default). Example 9-6 shows a document employing transformation and variants. Example 9-6. Transforming and varying text with CSS
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>working with style</title>
<style type="text/css">
body {font-family: Georgia, Times, serif; color: black;}
h1 {font-family: Arial, Helvetica, sans-serif; font-size: 24px;
font-variant: small-caps;}
h2 {font-family: Georgia, Times, serif; color: #999; font-size: 18px; font-style: italic;
You can see how text-TRansform and font-variant work in Figure 9-13. Figure 9-13. Transforming and varying text.
Browsers that provide full support for transforming and varying text will apply the styles regardless of the case your text is actually composed in. Of course, for sensible reasons, you'll want your text content to be treated normally in the document. This way, you can always change the styles without having to reauthor the document. NOTE Browser support for text-transform and font-variant is pretty good overall, but one known issue in contemporary browsers is that font-variant: small-caps; does not work in certain early versions of the popular Safari browser from Apple. The style simply won't be applied in any way, and the text will pick up only those styles that Safari does support. |
