Search code examples
cssfavicon

Change color of the button and i class on hover


I have a class containing span and i class favicon. On hover I want to change color of the button and icon at the same time. How can it be achieved?

here is an example of my code:

CSS

a.btn.btn-seeinfo:hover .fa-chevron-right{
    color: #597692;
    background-color: transparent;
}

HTML

<a class="btn btn-seeinfo">
    <span>"See info"</span>
    <i class="fa fa-chevron-right"></i>
</a>

Solution

  • <!DOCTYPE html>
    <html>
    <head>
    <title>Font Awesome Icons</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css">
    <style>
    .btn-seeinfo:hover {
        color: red;
        background-color: transparent;
    cursor:pointer;
    }
    </style>
    </head>
    <body>
    
    
    <a class="btn btn-seeinfo">
        <span>"See info"</span>
        <i class="fa fa-chevron-right"></i>
    </a>
    
    
    </body>
    </html>