Reputation: 821
I have a button with a default green background. On hover
, the background color is changed.
When the button is clicked, I want it to fall back to the green background.
How do I achieve this? I tried the following without success:
.btn {
background-color: #4dd0e1
}
.btn:hover {
background-color: #01579b
}
.btn:active {
background-color: #4dd0e1
}
.btn:visited {
background-color: #4dd0e1
}
<a href="#" target="_blank" class="waves-effect btn"><i class="material-icons right">arrow_forward</i>button</a>
Thanks!
Upvotes: 3
Views: 13776
Reputation: 2069
Try this one~
<style>
.btn:hover{background-color: #b44ce1}
.btn{background-color: #b44ce1}
</style
<a class="waves-effect waves-light btn">Submit</a>
It works well for me~
Upvotes: 0
Reputation: 10274
.btn{
background-color: aqua
}
.btn:visited{
background-color: yellow
}
.btn:hover {
background-color: skyblue
}
.btn:active{
background-color: pink;
}
.btn:focus{
background-color: pink;
}
<a href="#" target="_blank" class="waves-effect btn"><i class="material-icons right">arrow_forward</i>button</a
You should follow this order when you write css code
a:link
a:visited
a:hover
a:active
a:focus
I don't know why, but it makes working your code.
You just change order of CSS Selectors (:visited
, :hover
, :active
, :focus
)
Upvotes: 6
Reputation: 11
Use MaterializeCss colors helper clases Materialize Colors
<a class="waves-effect waves-light btn amber darken-4">button</a>
Upvotes: 1