Use Multiple CSS Classes
Did you know you can use multiple css classes in an html element? I'm sure you knew that, but in any case, here's an example of how someone might have done this in the past:
<style type="text/css">
.e {color:red; font-size:12px;}
.eBold {color:red; font-size:12px; font-weight:bold;}
</style>
Here is some error text
Here is some bold error text
But now, you can do this with much more ease... The second class will inherit/overwrite anything mentioned in the first class.
Here we will inherit:
<style type="text/css">
.e2 {color:red; font-size:12px;}
.eBold2 {font-weight:bold;}
</style>
Here is some error text
Here is some bold error text
Here we will overwrite:
<style type="text/css">
.e3 {color:red; font-size:12px;}
.eBold3 {color:green}
</style>
Here is some error text
Here is some green error text
This is a simple example, but the possibilities are endless. Ideas for use would be creating classes for specific criteria: errors, small text, important text, required textbox fields, images with borders, distinct links... and the list goes on.
- Login to post comments
- 2751 reads
User login
Menu
Who's online
Powered by Drupal - Design by Artinet - © 2007 SEO Cactus










