Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

200
Visualizações
Keyframes opacity with image css

I have created a double sided box, that when you hover, shows the flip side. I have added in a keyframe that goes from opacity: 0 to opacity: 1 to create a fade effect on hover.

It works to flip the card, however when you move the cursor off the box to return to it's original state, the image does not fade out, and you can see the background of the image when you should not. Please refer to the example below.

.catInner3 {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  grid-template-rows: repeat(1, 280px);
}

p {
  color: white;
}

.iprodBox {
  background-color: #ffffff;
  width: 330px;
  height: 230px;
  cursor: pointer;
  transition: 1s;
  box-shadow: 3px 1px 6px rgba(0, 0, 0, 0.25);
}

.iprodImg {
  height: 80%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.iprodImg img {
  object-fit: contain;
  height: 70%;
  width: 70%;
}

.iprodTitle {
  height: 20%;
  width: 100%;
  background-color: #184e77;
  box-shadow: 3px 1px 6px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 1s;
}

.iprodDesc {
  position: relative;
  bottom: 80%;
  height: 100%;
  width: 100%;
  text-align: center;
  align-items: center;
  justify-content: center;
  display: none;
}

.iprodBox:hover>.iprodDesc {
  display: flex !important;
  animation: fade 1s;
}

.iprodBox:hover>.iprodImg img {
  display: none !important;
  animation: fade 1s;
}

.iprodBox:hover>.iprodTitle {
  display: none !important;
  animation: fade 1s;
}

.iprodBox:hover {
  background-color: #184e77;
}
<div class="catInner3">
  <a class="iprodBox">
    <div class="iprodImg">
      <img src="https://i.ibb.co/kXY1pG0/meme.jpg"/>
    </div>

    <div class="iprodTitle">
      <p>Test Title</p>
    </div>
    <div class="iprodDesc">
      <div class="vertDesc">
        <p style="font-size: 20px;">Test Title</p>
        <p style="display: inline-flex; width: 75%">Test Text</p>
      </div>
    </div>
  </a>
</div>

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda