Independent Classes

Suppose you want to create a style that could be used with several different selectors, if that is the case then you would create an independent class. The format is the same as the class selector but you do not include a selector. Let's say you want a style that centers the text and makes it lightblue in color. Here is how you would create this independent class:

.myclass { text-align: center; color: lightblue }

To apply this class you would follow the same rules that you used with the class selector in the previous example:

< p class="myclass"> but since this is an idependent class it can be applied to ANY selector
<div class="myclass> or <h1 class="myclass"> or <td class="myclass">.


Pseudo Classes

This concludes the Class Styles and Independent Classes Exercise

For the latest on web technologies and web design check back here often.
What's in, what's out, and why you should know. Updated daily. Have a nice day!