Share this Page URL
Help

Chapter 14. A Beginner's Guide to Style ... > Three Sheets to the Web: Style Sheet... - Pg. 164

A Beginner's Guide to Style Sheets 164 The TitleText class uses a font size of 20 points, navy text, and a center alignment; the SubtitleText class uses a font size of 16 points, gray text, and a center alignment. To use these classes, add a CLASS attribute to the tags you want the styles applied to, and set it equal to the class name (without the dot). Here's a for instance: <DIV CLASS="TitleText">This is the Title of the Document</DIV> The advantage here is that if you decide to change this style, you need edit only the style class; after that, every tag that uses the class changes automatically. Here's a page (see ssclass.htm on the CD in this book) that offers up a complete example. <HTML> <HEAD> <TITLE>Style Sheets: Styles Classes</TITLE> </HEAD> <STYLE TYPE="text/css"> <!-- .TitleText {font-size: 20pt; color: Navy; text-align: center} .SubtitleText {font-size: 16pt; color: Gray; text-align: center} --> </STYLE> <BODY> <DIV CLASS="TitleText">This is the Title of the Document</DIV> <DIV CLASS="SubtitleText">This is the Subtitle of the Document</DIV> </BODY> </HTML> Figure 14.5 shows how Internet Explorer interprets the classes.