Reputation: 2861
I havent done CSS in awhile (~5-7yrs).
So i need a little assistance in a possible solution to my quandry.
Ideal design:
table.ctable
{ class:collapsible collapsed; }
Now i know that its syntactically not correct but was wondering if there was a way to create some base-class CSS and then have those class(es) derive into a parent. I know its not OOP, but figured there would be a way around the current structure to accomidate this type of inclusion.
Upvotes: 0
Views: 102
Reputation: 37763
You couls use a SASS mixin:
@mixin left($dist) {
float: left;
margin-left: $dist;
}
#data {
@include left(10px);
}
or a LessCSS mixin:
.left(@dist) {
float: left;
margin-left: @dist;
}
#data {
.left(10px);
}
Upvotes: 1
Reputation: 324610
No, unfortunately you can't inherit rules from another class. The closest you can get is JavaScript getting elements by class name and applying extra classes to them, but then you have the jump between the page loading the JS running.
Upvotes: 1