Looking for a streamlined way to style buttons? I have a class called .button-small
that sets the colors and dimensions:
.button-small {
background: linear-gradient(to bottom, #59aeee 1%,#4ea0dc 100%); /* W3C */
border-radius: 3px;
cursor: pointer;
width: 20px;
height: 20px;
}
In addition to this class, I want to include different states like .button-small:active
.
The challenge arises when dealing with multiple buttons, each requiring a unique image. To address this, I created separate classes for customizing backgrounds:
.user-chat {
background: url('images/userchat.png') center center no-repeat;
}
The issue is that applying both classes in HTML
<div class="button-small user-chat"></div>
removes color information from the main .button-small
class. Although I tried including background info, such as:
.user-chat {
background: url('images/userchat.png') center center no-repeat, linear-gradient(to bottom, #73b5e7 1%,#429be0 100%)`
}
This approach becomes inefficient when adding various button states to each button, especially considering the number of buttons involved.
My goal is to find a way to overlay transparent-background png
images on buttons without affecting their state. Is there a solution for this problem, or what would be the most effective method to accomplish this?