Hi,
I'd like to know if the following can be done:
Regards,Code:.some-class { (get all the properties of .other-class) }
jj.![]()
| SitePoint Sponsor |





Hi,
I'd like to know if the following can be done:
Regards,Code:.some-class { (get all the properties of .other-class) }
jj.![]()

Not directly, but you can do this:
Code CSS:.someclass, .otherclass { // properties both classes need to have } .someclass { // properties for someclass only } .otherclass { // properties for otherclass only }
![]()
Rémon - Hosting Advisor
Minimal Bookmarks Tree
My Google Chrome extension: browsing bookmarks made easy





it appears to me you are describing cascadingCode:.some-class { (get all the properties of .other-class) }![]()





if .other-class are children of .some-class then "inherit" in the css styles should work.

As others stated you can't have a class inherit CSS. Only a few properties inherit to children elements but most don't (which makes sense, if margins/paddings/backgrounds inherited to children, then that'd be a mess
)
Also note that the inherit value (as the above poster has stated) will work, HOWEVER IE7 and down don't support inherit except on a few minor properties (they won't help you with simple designing of a page)
Twitter-@Ryan_Reese09
http://www.ryanreese.us -Always looking for web design/development work





he said it wrong, but aren't you forgetting the case when the classes are for the same element?
h1 {many css rules here}
h1.more {/*has the rules from h1 + */ additional css rules }
h1.moreandmore {/*has the rules from h1, but none from h1.more + */ some other additional css rule}
i believe it's called exactly inheritance
h1.more {
(get all the properties of h1)
}

As I'm sure you already knew, even as I worded my post, I was talking about this
<div style="margin-left:100px;"><span>ljf</span></div>
Had the span inherited the left margin then the span would be 200px over. I wasn't saying you can't inherit stuff via being more selective with your CSS rules, not at all.
Twitter-@Ryan_Reese09
http://www.ryanreese.us -Always looking for web design/development work





What I want to do can't be done, then
The mood in the CSS forum is always a pleasure![]()
Bookmarks