I have one base .base{} in my CSS file with couple properties. I want to change only color and other properties to stay same. How to inherit this base class inother classe
As others have already mentioned, there is no concept of OOP inheritance in CSS. But, i have always used a work around for this.
Let's say i have two buttons, and except the background image URL, all other attributes are common. This is how i did it.
/*button specific attributes*/
.button1 {
background-image: url("../Images/button1.gif");
}
/*button specific attributes*/
.button2 {
background-image: url("../Images/button2.gif");
}
/*These are the shared attributes */
.button1, .button2 {
cursor: pointer;
background-repeat: no-repeat;
width: 25px;
height: 20px;
border: 0;
}
Hope this helps somebody.