• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 14. Setting up Style Sheets > Defining Styles for Classes

Defining Styles for Classes

You can divide your HTML elements into categories or classes in order to apply styles to them selectively. For example, you can create a class of introductory paragraphs that will have slightly different formatting than regular paragraphs.

To define styles for classes:

1.
Mark the elements in your HTML page that belong to the class by addingCLASS=classname (where classname is the identifying word for the class) to the appropriate HTML tags.

2.
In the STYLE section of your HTML page, type parenttag.classname, where parenttag is the tag that the class is a subset of, and classname is the same as in step 1. (Yes, that's a period between the parent tag and the class name.)

3.
Type a curly bracket { to begin the definitions.

4.
Type property:value to specify the additional properties that should be applied to elements of this class.

5.
If desired, type a semicolon ; and then specify additional properties and values (see pages 257–290).

6.
Type a right curly bracket } to complete the class definition.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint