Inherintances

Discussion in 'HTML' started by freesoft_2000, Sep 25, 2006.

  1. Say I have a css class like:

    .foo {
    background-color: blue;
    width: 500px;
    }

    and I have another class:

    .central {
    margin-left: auto;
    margin-right: auto;
    }

    I want 'foo' to inherit the properties of 'central'.

    Is this possible to be done?

    Any help is greatly appreciated

    Thank You

    Yours Sincerely

    Richard West
     
    freesoft_2000, Sep 25, 2006
    #1
    1. Advertising

  2. freesoft_2000 wrote:
    > Say I have a css class


    There is no such thing. HTML has classes, CSS doesn't.

    > .foo {
    > background-color: blue;
    > width: 500px;
    > }


    That is a ruleset with a class selector, not a class.

    > and I have another class:


    Ditto

    > I want 'foo' to inherit the properties of 'central'.


    You can't, but see http://dorward.me.uk/www/css/inheritance/
     
    David Dorward, Sep 25, 2006
    #2
    1. Advertising

  3. freesoft_2000 wrote:
    > Say I have a css class like:
    >
    > .foo {
    > background-color: blue;
    > width: 500px;
    > }
    >
    > and I have another class:
    >
    > .central {
    > margin-left: auto;
    > margin-right: auto;
    > }
    >
    > I want 'foo' to inherit the properties of 'central'.
    >
    > Is this possible to be done?



    No inheritance in CSS but your can to this:

    <ELEMENT class="foo central">...</ELEMENT>

    then ELEMENT with have styling rules of 'foo' & 'central'


    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Sep 25, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page