1
Good night!
I’m looking to make a site and in one part of it I’m looking to do a fadein animation with css, when the user hovers the mouse in the DIV appears another not in a "dry" way but with some transition. But I’m going through a hard time, I’ve put Animation in the parent class, but it still doesn’t work.
If anyone can help I’d appreciate it!
follows below the HTML and CSS code I made
.minha-foto {
background-repeat: no-repeat;
background-position: center center;
background-size: cover;
min-height: 325px;
max-height: 325px;
display: flex;
justify-content: center;
align-items: center;
margin: 0 auto;
min-width: 300px;
max-width: 300px;
}
.minha-foto .redes-sociais {
width: 100%;
height: auto;
position: absolute;
top: 0;
bottom: 0;
display: flex;
justify-content: center;
align-items: center;
background: linear-gradient(to bottom, rgba(0, 0, 0, 0.4) 0, rgba(0, 0, 0, 0.4) 100%);
display: none;
animation-duration: 0.7s;
animation-fill-mode: both;
animation-name: fadeIn;
}
.minha-foto .redes-sociais ul {
display: flex;
list-style: none;
padding-left: 0;
}
.minha-foto .redes-sociais ul li {
margin-left: 10px;
width: 50px;
height: 50px;
display: flex;
justify-content: center;
align-items: center;
}
.minha-foto .redes-sociais ul li a i {
font-size: 30px;
color: #fff;
}
.minha-foto .redes-sociais:hover ul li:first-child {
background: #3074B3;
}
.minha-foto .redes-sociais:hover ul li:nth-child(2) {
background: #575EA4;
}
.minha-foto .redes-sociais:hover ul li:last-child {
background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}
.minha-foto:hover .redes-sociais {
display: flex;
}
.minha-foto:hover .redes-sociais ul li {
width: 50px;
height: 50px;
}
<div class="col-md-5 minha-foto offset-md-2 my-auto" style="background-image:url('//localhost:3000/godoyportfolio/wp-content/themes/godoy/inc/img/eu-4.jpeg')">
<div class="redes-sociais">
<ul>
<li><a href="#"><i class="fab fa-linkedin"></i> </a></li>
<li><a href="#"><i class="fab fa-facebook-square"> </i></a></li>
<li><a href="#"><i class="fab fa-instagram"></i> </a></li>
</ul>
</div>
</div>
Buttons do not fade when leaving with the mouse.
– CypherPotato
@Cypherpotato here worked normal, as in demonstrated in gif. I don’t quite understand what you meant about the buttons... can you explain me better to check?
– hugocsl
In GIF Glitch also occurs. When leaving with the image mouse, the black overlay fades, however, the social buttons simply disappear immediately.
– CypherPotato
@Cypherpotato you were right, man, I didn’t notice. The problem was that the element had no background, the background only appeared in Hover, so it had the smooth transition in the element, what it did not have was the transition in the background of the buttons. I’ll just take the background from the
:hover
and decided it was worth the touch– hugocsl
Got it, man, thanks a lot for your help, you saved :)
– Felipe Godoy
@Felipegodoy no problem my dear, tmj
– hugocsl