Can a CSS class inherit one or more other classes?

Posted by Joel Martinez on Stack Overflow See other posts from Stack Overflow or by Joel Martinez
Published on 2009-06-30T19:10:57Z Indexed on 2013/10/23 21:54 UTC
Read the original article Hit count: 185

Filed under:

I feel dumb for having been a web programmer for so long and not knowing the answer to this question, I actually hope it's possible and I just didn't know about rather than what I think is the answer (which is that it's not possible).

My question is whether it is possible to make a CSS class that "inherits" from another CSS class (or more than one).

For example, say we had:

.something { display:inline }
.else      { background:red }

What I'd like to do is something like this:

.composite 
{
   .something;
   .else
}

where the ".composite" class would both display inline and have a red background

© Stack Overflow or respective owner

Related posts about css