To change the background color of a button that has been clicked, use background-color property. The example is given below.
Change button's background-color on hover
Change button background-color on hover
Try it Yourself »
Create a html button element with a class named .btn. To change button's background color on hover use the :hover pseudo class Inside the style tag.
<style>
.btn:hover {
background-color:green;
}
</style>
Change button background color using focus pseudo class.
Change button background-color using focus
Try it Yourself »
Comments (0)