Changes

Jump to: navigation, search

Understanding Cascading Style Sheets (CSS)

679 bytes added, 17:57, 17 May 2007
Using Classes with CSS Rules
== Using Classes with CSS Rules ==
 
The techniques we have looked at so far are good for specifying styles for either all tags of a certain type, or for individual tag (either by id or byu specifying a style by embedding it into the HTML tag itself). The ''class' attribute can be used when a style needs to be applied to a range of tags. A 'class' style rule is specified by prefiong the class name with a dot (.):
 
<pre>
.introtext {color:red; font-size: 12px}
</pre>
 
Having specified the rule, we need to then reference the class in our HTML elements:
 
<pre>
<P class="introtext">This is the intorduction</P>
</pre>
 
Any HTML tag in whcih we reference the class ''intotext'' will inherit those style settings.

Navigation menu