Re: Multiple Classes ..;

by Jeremy Duncanson <aesic(at)softhome.net>

 Date:  Wed, 26 Jun 2002 07:54:42 -0500
 To:  hwg-techniques(at)hwg.org
 In-Reply-To:  PCPETERM
  todo: View Thread, Original
At 2:06 PM +0200 on 6/26/02, peter wrote:


> Hi,
>
> A question about adding styles.  I have a number of block items in my page
> that have to get a rather complex class tied to.  Now preactically, the
> classes differ from each other in only a very limited number of elements.
> For example, they all use the same margin, padding and border, but just a
> different font style.
>
> Now I would like to consolidate the css files into one class defining those
> margins and the other classes defining the differences.  The problem then
> is, how can I assign multiple classes (the one defining margins and the one
> defining text style) to one block element?


You can keep them as seperate classes and still simplify the CSS by doing
something like this:

.classone, .classtwo, .classthree {
  padding, margin and border settings
}

.classone {
  font style
}

.classtwo {
  font style
}

.classthree {
  font style
}


If you were to use IDs on the elements, you could combine the CSS with
javascript to change the styles and use just one class. It even works in NN
4.x, not that all changes would get rendered. ;)

Jeremy Duncanson

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA