Carregando...

Efeito hover vintage

Postado: 9 de janeiro de 2023 Tempo de Leitura: 2 Minutos

Efeito hover vintage

Hoje vamos criar um módulo hover vintage com html e css para listar produtos ou artigos

Nesta seção, projetaremos uma estrutura básica no html. 

Usaremos A Tag <div><h2>, <img>, <p> e a tag <a> para inserirmos o <link> de destino.

Essas são as tags que usaremos no html

Vamos Adicionar o Html

    <div class="wrapper">
      
        <div class="box vintage">
            
            <img src="uploads/vintage.jpg" alt="Vintage" title="Vintage">
            <h2>Vintage</h2>
            
            <p>
                O termo vintage significa algo clássico e antigo que foi usado e está em...<br>
                <a href="https://pt.wikipedia.org/wiki/Vintage_(moda)" target="_blank">Leia mais...</a>
            </p>
        
        </div>
    
    </div>

    <div class="wrapper">

        <div class="box vintage">
            
            <img src="uploads/tower-bridge.jpg" alt="Tower Bridge" title="Tower Bridge">
            <h2>Tower Bridge</h2>
            
            <p>
                E uma ponte-báscula construída sobre o rio Tâmisa, na cidade de Londres...<br>
                <a href="https://pt.wikipedia.org/wiki/Ponte_da_Torre" target="_blank">Leia mais...</a>

            </p>
        
        </div>

    </div>
    
    <div class="wrapper">

        <div class="box vintage">
            
            <img src="uploads/london.jpg" alt="London" title="London">
            <h2>Londres</h2>
            
            <p>
                Londres, capital da Inglaterra e do Reino Unido, é uma cidade do século 21 com...<br> 
                <a href="https://pt.wikipedia.org/wiki/Londres" target="_blank">Leia mais...</a>

            </p>
        
        </div>
   
    </div>

Vamos Adicionar o CSS

Nesta seção, usaremos algumas propriedades CSS para estilizar e da o efeito desejado.

.wrapper {
  
  width: 100%;
  float: left;
  height: 100%;
  padding: 10px;

}

.box {

  position: relative;
  height: 100%;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 1.4px 1.7px rgba(0, 0, 0, 0.017), 0 3.3px 4px rgba(0, 0, 0, 0.024), 0 6.3px 7.5px rgba(0, 0, 0, 0.03), 0 11.2px 13.4px rgba(0, 0, 0, 0.036), 0 20.9px 25.1px rgba(0, 0, 0, 0.043), 0 50px 60px rgba(0, 0, 0, 0.06);

}

.box .hide {

  opacity: 0;

}

.box .frame {

  position: absolute;
  border: 1px solid #fff;
  z-index: 2;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

}

.box h2, .box p {

  position: absolute;
  color: #fff;
  z-index: 2;
  width: 100%;
  transition: opacity 0.2s, transform 0.6s;

}

.box h2 {
  
  font-family: 'open_sansbold'; 
  font-weight: bold;
  font-size: 30px;
  text-shadow: 2px 1px 5px #2d1a0c;
  margin-bottom: 0;
  letter-spacing: 1px;

}

.box p {

  bottom: 0;
  font-size: 14px;
  letter-spacing: 1px;

}

.box p a {

  text-decoration: underline;
  color: #ecbd07;
  font-weight: bold;

}

.box:hover {

  transition: all 0.6s ease-in-out;

}

.box:hover:before { transition: all 0.3s ease-in-out; }

.box img {

  position: relative;
  width: 100%;
  height: 100%;
  z-index: 1;
  transition: all 0.3s ease-in-out;

}

.box img:hover { transition: all 0.3s ease-in-out; }

.box img:after {

  content: "";
  position: absolute;
  background-color: rgba(0, 0, 0, 0.3);
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  opacity: 0;

}

.box img:hover { transition: all 0.3s ease-in-out; }

/*Efeito Vintage*/
.vintage h2 {

  top: 40%;
  transform: translate3d(0, 80px, 0);
  text-align: center;

}

.vintage p {

  opacity: 0;
  bottom: 0;
  transform: translate3d(0, -10px, 0);
  font-size: 14px;
  letter-spacing: 1px;
  padding: 0 10px;
  text-align: center;

}

.vintage:before {

  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, rgba(117, 34, 34, 0) 0%, rgba(130, 109, 70, 0.97) 70%);
  z-index: 2;
  bottom: -100%;
  left: 0;

}

.vintage:hover:before { bottom: 0; }

.vintage:hover h2 {
  
  bottom: 10px;
  transform: translate3d(0, 15px, 0);

}
.vintage:hover p {

  opacity: 1;
  transform: translate3d(0, -22px, 0);

}

/*960PX BREAKPOINT*/
@media (min-width:60em){

  .wrapper { width: 33.3%; }

}

/*1280PX BREAKPOINT*/
@media (min-width:80em){

  .vintage:hover h2 { transform: translate3d(0, 55px, 0); }
 
}

Combinando as Duas seções acima Html + Css temos o seguinte Resultado!

Veja o Resultado baixo!

Baixar Código Veja Funcionando

Publicado por: Loop Nerd

122 Visualizações

Tags

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

Artigos Relacionados