Jump to content

class inheritance


jordanwb

Recommended Posts

No. But you can name multiple selectors in one call. For example if you have:

 

.classA
{
   // some stuff
}

 

And you want classB to inherit the selectors from classA, you just add classB, separated with a comma:

 

.classA, .classB
{
  // some stuff
}

 

In this case, classB will have the same properties as classA. You can then define the classB properties that are unique to it, below the current CSS.

Link to comment
Share on other sites

Is it possible to have one CSS class inherit another?

 

Although you can't do this strictly in css, you can play around with the markup and make a certain class be the parent div of a div that you want to have the styles inherited to. I don't know if that makes sense, but that's the logical reasoning behind the way css works.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.