The class selector allows you to style items within the same (X)HTML element differently. With classes the style can be overwritten by changing out stylesheets. You can use the same class selector again and again within an (X)HTML file.

 

HTML Code

<p>
The following word will appear <span class=”greenboldtext”>green</span> and bolt.
</p>

 

CSS Code

.greenboldtext { 
   color: #008080;
   font-weight: bold;
}