Class selectors


show more Class selectors provides you with in-depth training on Web. Taught by Garrick Chow as part of the Dreamweaver CS3 Essential Training show less
please wait ...

Class selectors

Now let's talk about Class Selectors. Class Selectors let you create a custom selector name, kind of like you can do with ID selectors, and then apply that style to an XHTML element using the class attribute. But unlike the ID selector, which should only be applied to one element on the page, Class Selectors can be applied to as many elements as you need. Here's an example of how to a Class Selector is written out. We have the name of the class, in this case .smallprint. Class Sectors always start with a period, followed by the name that you come up with, in this case we've named it smallprint. Then we have the declaration, in this case, which is font size is 10 pixels. This is how the style would appear on our style sheet.

To apply this style to a paragraph, like this, where we have, "This is some small text" surrounded by two paragraph tags, we're going to add the name of the Class Selector as an attribute, like this. The <p> tag would be followed by...

Class selectors
Video duration: 5m 41s 10h 21m Beginner

Viewers:

Class selectors provides you with in-depth training on Web. Taught by Garrick Chow as part of the Dreamweaver CS3 Essential Training

Subject:
Web
Software:
Dreamweaver
Author:
please wait ...