Extending a style class

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gokulrenga
    New Member
    • Oct 2007
    • 1

    Extending a style class

    Is it possible to extend a style class?
    for example i have to classes
    .common {
    color:red;
    }
    .commonFont {
    font-family:Arial;
    font-size:8pt;
    }
    I need the class commonFont also to have the properties of the class common.
    How can this be done?
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    Yes and no. It's possible for an element to inherit styles from parent elements. For example, if you have a <h1 class="mystyles "> and <h2> inside a <div>, you can apply all the styles of <div> to the <h1> with:
    div h1{
    your styles
    }
    or better yet:
    div .mystyles{

    Another way is with "selectors" .

    Comment

    Working...