March 24, 2006

Multiple CSS Classes on One Element/Control

You can apply multiple css styles on one element.

For example, let's assume we have two css classes in the style sheet named "nrml" and "center" respectively
.nrml { font-family: Arial, Verdana; font-size:10px;}
.center { text-align: center;}

You can apply both the above 2 styles to a div using the following syntax.
<div class="nrml center" id="Layer2">

It will render with both classes applied in Internet Explorer 5.0+, Netscape 7+ and Opera 7.
CSS 2.0 is really cool and there are lot of powerful unexplored areas

1 comment: