Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

create a third class from existing two classes in css

I have 2 classes class A and Class B in CSS..I need to create a 3 class named Class C and add some styles in that in addition to the styles of class A and Class B.Is it possible to inherit Class A and B in C?

like image 700
adddd Avatar asked Jul 22 '11 10:07

adddd


2 Answers

It's not possible to inherit classes without dynamically generating your CSS file.

However, you can add your additional style attributes to ClassC and use the following in your HTML:

<div class="ClassA ClassB ClassC">
like image 171
Curtis Avatar answered Oct 22 '22 23:10

Curtis


Inheritance is not possible with standard CSS. You could use a tool like less to achieve inheritance though.

like image 23
chelmertz Avatar answered Oct 22 '22 21:10

chelmertz