.mac{margin-left:auto; margin-right:auto;}
.table{.mac; color:red;}
I want to be able to do that, it doesn’t make sense to me why I would need to do:
.table{margin-left:auto; margin-right:auto; color:red;}
I know for the table I could do:
<table class="table mac">
or just type the .table{margin-left:auto; margin-right; color;} like above but that seems redundant.
Is there some way to do what I’m trying to accomplish in my first statement, is there some special syntax that I’m not aware of to make this work?
The short answer is no, you can’t “include” other CSS classes or “inherit” them so to speak.
There are tools you can use to abstract that kind of stuff for you, though. LESS comes to mind. I think the “mixin” is what you’re looking for.
Here is a code sample from the LESS front page: