I am making a website to hold all my projects, and I want an effect on where you hover over a Font awesome icon, it pulses in and out, however the :hover effect isn’t working at all. Even trying to change the font-size doesn’t work. I believe that something in the Font awesome sdk is overriding it, but there is every chance I’m just a fool.
Here is the CSS
body {
display: flex;
height: 100vh;
margin: 0;
}
.body-container {
display: flex;
align-items: center;
}
.links i {
font-size: 30px;
padding-right: 10px;
transition: transform 0.2s ease-in-out;
}
.links i:hover {
animation: pulse 3s forwards;
}
@keyframes pulse {
0% {
transform: scale(1);
}
50% {
transform: scale(1.2);
}
100% {
transform: scale(1);
}
}
.fade-in {
animation: fadeInAnimation 2s forwards;
}
@keyframes fadeInAnimation {
to {
opacity: 1;
}
}
::-webkit-scrollbar {
display: none;
}
Here is the HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Portfolio</title>
<script src="https://kit.fontawesome.com/19a251552a.js" crossorigin="anonymous"></script>
</head>
<body>
<div class="body-container fade-in">
<div class="home-text fade-in">
<h1>Damilola Owonibi</h1>
<p>Front End Developer</p>
<div class="links">
<i class="fa-brands fa-github"></i>
<i class="fa-brands fa-twitter"></i>
<i class="fa-brands fa-facebook"></i>
<i class="fa-brands fa-linkedin"></i>
</div>
</div>
<div class="image-div fade-in">
<img src="img/prof.png" id="image-div-pic" alt="">
</div>
</div>
<div class="area" >
<ul class="circles">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div >
</body>
</html>
2
Answers
See MDN on
transform
:The
i
element is, by default,display: inline
and thus generates a non-replaced inline box.Looks like things are working here, but there could issues in different browsers. Being that in
<i>
is an inline element, it could also cause issues. Give the<i>
elementsdisplay: inline-block;
. That should help. Additionally, if you want the item to really pulse, make sure to add infinite to the hover animation rule.