Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make font-awesome icon size increase on mouseover

I am using font-awesome with bootstrap 4 cards, is there anyway to increase the size of the font-awesome icon (bottom right) when I mouse over the button?

in this case <i class="fa fa-folder-open fa-5x"></i>

Here is the HTML

                <div class="col-md-3 col-sm-6">
                    <div class="card card-inverse card-success">
                        <div class="card-block bg-success">
                            <div class="rotate">
                                <i class="fa fa-folder-open fa-5x"></i>
                            </div>
                            <center><a class="btn btn-success show" target="1" role="button"><h5 class="text-uppercase">open cases &nbsp;&nbsp;<i class="fa fa-arrow-circle-right fa-1x"></i></h5></a></center>
                            <h1 class="display-1"><center>7</center></h1>
                        </div>
                    </div>
                </div>

Here is what it presently looks like

enter image description here

like image 464
user3436467 Avatar asked Sep 06 '25 03:09

user3436467


2 Answers

look maybe this help you

.rotate .fa.fa-folder-open:hover{
  font-size:6em;
  transition: 1s ease-out;
}

example

like image 197
alfredohb.q Avatar answered Sep 07 '25 21:09

alfredohb.q


Use .card:hover > .card-block > .rotate > .fa { } to target the icon.

Then you can use font-size: 6em; to enlarge the font or use the transform: scale() css.

Both look better adding a transition for the .fa so it will animate on hover.

EDIT: The transition should be set on .card > .card-block > .rotate > .fa { } (so without the :hover).

Example: .card > .card-block > .rotate > .fa { transition: font-size 0.35s ease; } .card:hover > .card-block > .rotate > .fa { font-size: 5em; }

(Don't forget to add extra rules with prefixes for cross-browser compatibility, see caniuse.com or W3schools for reference.)

like image 21
Philip Avatar answered Sep 07 '25 20:09

Philip