Carregando...

Botão html css efeito hover

Postado: 27 de dezembro de 2022 Tempo de Leitura: 3 Minutos

Botão html css efeito hover

Neste tutorial veja como criar um Botão css efeito hover.

Nesta seção, projetaremos as estruturas com as tags abaixo. 

Usaremos A Tag <a><span>, <i> e a tag <p>.

Essas tags usaremos para criar o nosso Botão html css efeito hover.

Vamos Adicionar o HTML

   <a class="btn mais-btn" href="#">
                    
      <span class="fl"></span>
      <span class="sfl"></span>
      <span class="sinal"></span>
      <i></i>
      <p>Veja mais</p>
                    
   </a>

Vamos Adicionar o CSS

Nesta seção, usaremos algumas propriedades CSS para estilizar a nosso Botão html e css.

.btn {

    width: 150px;
    border-radius: 3px;
    cursor: pointer;
    position: absolute;
    font-family: "Roboto";
    text-transform: uppercase;
    color: #4c4c4c;
    letter-spacing: 0.5px;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    outline: none;
    text-decoration: none;
    text-align: center;
  
}

.mais-btn {
    border-right: 2px solid #4c4c4c;
    border-bottom: 2px solid #4c4c4c;
    padding: 17px 29px 15px 31px;
    border-color: #4c4c4c;
}

.mais-btn p {
  font-size: 14px;
}


.mais-btn:before {
    left: 0;
    bottom: 0;
    height: -webkit-calc(100% - 17px);
    height: calc(100% - 17px);
    width: 2px;
}

.mais-btn:after, .mais-btn:before {
    content: " ";
    display: block;
    background: #4c4c4c;
    position: absolute;
    -webkit-transition: .5s;
    transition: .5s;
    z-index: 10;
}

.mais-btn:after {
    top: 0;
    right: 0;
    width: -webkit-calc(100% - 17px);
    width: calc(100% - 17px);
    height: 2px;
}

.mais-btn:after, .mais-btn:before {
    content: " ";
    display: block;
    background: #4c4c4c;
    position: absolute;
    -webkit-transition: .5s;
    transition: .5s;
    z-index: 10;
}

.mais-btn:before {
    left: 0;
    bottom: 0;
    height: -webkit-calc(100% - 17px);
    height: calc(100% - 17px);
    width: 2px;
}

.mais-btn:after, .mais-btn:before {
    content: " ";
    display: block;
    background: #4c4c4c;
    position: absolute;
    -webkit-transition: .5s;
    transition: .5s;
    z-index: 10;
}

.mais-btn .fl, .mais-btn .sfl {
    position: absolute;
    right: 0;
    height: 100%;
    width: 0;
    z-index: 2;
    background: #4c4c4c;
    top: 0;
    -webkit-transition: .5s;
    transition: .5s;
    -webkit-transition-delay: .1s;
    transition-delay: .1s;
}

.mais-btn .fl, .mais-btn .sfl {
    position: absolute;
    right: 0;
    height: 100%;
    width: 0;
    z-index: 2;
    background: #4c4c4c;
    top: 0;
    -webkit-transition: .5s;
    transition: .5s;
    -webkit-transition-delay: .1s;
    transition-delay: .1s;
}

.mais-btn .sfl {
    z-index: 1;
    background: #4c4c4c;
    -webkit-transition: .7s;
    transition: .7s;
}

.mais-btn .sinal {
    position: absolute;
    z-index: 15;
    width: 18px;
    height: 18px;
    top: -webkit-calc(50% - 8px);
    top: calc(50% - 8px);
    left: -webkit-calc(50% - 8px);
    left: calc(50% - 8px);
}

.mais-btn .sinal:before {
    width: 100%;
    height: 2px;
    top: 8px;
    left: 0px;
    -webkit-transform: translateX(50px) scaleX(0);
    -ms-transform: translateX(50px) scaleX(0);
    transform: translateX(50px) scaleX(0);
}

.mais-btn .sinal:before, .mais-btn .sinal:after {

    content: "";
    background: #fff;
    display: block;
    position: absolute;
    opacity: 0;
    -webkit-transition-duration: .3s;
    transition-duration: .3s;
    -webkit-transition-delay: 0s;
    transition-delay: 0s;
    -webkit-transition-timing-function: cubic-bezier(0.86, 0, 0.07, 1);
    transition-timing-function: cubic-bezier(0.86, 0, 0.07, 1);

}

.mais-btn .sinal:after {
    
    width: 2px;
    height: 100%;
    left: 8px;
    top: 0;
    -webkit-transform: translateY(20px) scaleY(0);
    -ms-transform: translateY(20px) scaleY(0);
    transform: translateY(20px) scaleY(0);
    -webkit-transition-duration: .4s;
    transition-duration: .4s;

}

.mais-btn .sinal:before, .mais-btn .sinal:after {
    content: " ";
    background: #fff;
    display: block;
    position: absolute;
    opacity: 0;
    -webkit-transition-duration: .3s;
    transition-duration: .3s;
    -webkit-transition-delay: 0s;
    transition-delay: 0s;
    -webkit-transition-timing-function: cubic-bezier(0.86, 0, 0.07, 1);
    transition-timing-function: cubic-bezier(0.86, 0, 0.07, 1);
}

.mais-btn i {
    position: absolute;
    display: block;
    top: 1px;
    left: 1px;
    -webkit-transition: .5s;
    transition: .5s;
    z-index: 10;
}

.mais-btn i:before {

    -webkit-transform: rotate(90deg);
    -ms-transform: rotate(90deg);
    transform: rotate(90deg);

}

.mais-btn i:after, .mais-btn i:before {
   
    content: "";
    display: block;
    width: 2px;
    height: 20px;
    background: #4c4c4c;
    position: absolute;
    margin: -10px -1px;
    left: 50%;
    top: 50%;
    transition: 0.3s;

}

.mais-btn:hover i:after {
    content: " ";
    display: block;
    width: 2px;
    height: 20px;
    background: #4c4c4c;
    position: absolute;
    margin: 0px -1px;
    left: 50%;
    top: 50%;
}

.mais-btn:hover i:before {
    content: " ";
    display: block;
    width: 2px;
    height: 20px;
    background: #4c4c4c;
    position: absolute;
    margin: -10px 0px -10px 8px;
    left: 50%;
    top: 50%;
}

.mais-btn p {
    -webkit-transition: .5s;
    transition: .5s;
    position: relative;
    z-index: 1;
}

.mais-btn:hover:before, .mais-btn:before {
    height: 100%;
}

.mais-btn:before {
    left: 0;
    bottom: 0;
    height: -webkit-calc(100% - 17px);
    height: calc(100% - 17px);
    width: 2px;
}

.mais-btn:hover .fl, .mais-btn .fl {
    -webkit-transition: .7s;
    transition: .7s;
}

.mais-btn:hover .fl, .mais-btn:hover .sfl, .mais-btn .fl, .mais-btn .sfl {
    -webkit-transition-delay: 0s;
    transition-delay: 0s;
    width: 100%;
}

.mais-btn .fl, .mais-btn .sfl {
    position: absolute;
    right: 0;
    height: 100%;
    width: 0;
    z-index: 2;
    background: #4c4c4c;
    top: 0;
    -webkit-transition: .5s;
    transition: .5s;
    -webkit-transition-delay: .1s;
    transition-delay: .1s;
}

.mais-btn:hover .sfl, .mais-btn. .sfl {
    -webkit-transition: .5s;
    transition: .5s;
}

.mais-btn:hover .fl, .mais-btn:hover .sfl, .mais-btn.hvd .fl, .mais-btn.hvd .sfl {
    -webkit-transition-delay: 0s;
    transition-delay: 0s;
    width: 100%;
}

.mais-btn .sfl {
    z-index: 1;
    background: #4c4c4c;
    -webkit-transition: .7s;
    transition: .7s;
}

.mais-btn .sinal {

    position: absolute;
    z-index: 15;
    width: 18px;
    height: 18px;
    top: -webkit-calc(50% - 8px);
    top: calc(50% - 8px);
    left: -webkit-calc(50% - 8px);
    left: calc(50% - 8px);

}

.mais-btn:hover .sinal:before, .mais-btn .sinal:before {
    -webkit-transition-duration: .5s;
    transition-duration: .5s;
}

.mais-btn:hover .sinal:after, .mais-btn:hover .sinal:before, .mais-btn .sinal:after, .mais-btn .sinal:before {
    -webkit-transform: none;
    -ms-transform: none;
    transform: none;
    opacity: 1;
    -webkit-transition-delay: .2s;
    transition-delay: .2s;
}

.mais-btn .sinal:after {
    width: 2px;
    height: 100%;
    left: 8px;
    top: 0;
    -webkit-transform: translateY(20px) scaleY(0);
    -ms-transform: translateY(20px) scaleY(0);
    transform: translateY(20px) scaleY(0);
    -webkit-transition-duration: .4s;
    transition-duration: .4s;
}

.mais-btn .sinal:before, .mais-btn .sinal:after {
    content: " ";
    background: #fff;
    display: block;
    position: absolute;
    opacity: 0;
    -webkit-transition-duration: .3s;
    transition-duration: .3s;
    -webkit-transition-delay: 0s;
    transition-delay: 0s;
    -webkit-transition-timing-function: cubic-bezier(0.86, 0, 0.07, 1);
    transition-timing-function: cubic-bezier(0.86, 0, 0.07, 1);
}

.mais-btn:hover .sinal:after, .mais-btn:hover .sinal:before, .mais-btn.hvd .sinal:after, .mais-btn.hvd .sinal:before {
    -webkit-transform: none;
    -ms-transform: none;
    transform: none;
    opacity: 1;
    -webkit-transition-delay: .2s;
    transition-delay: .2s;
}

.mais-btn:hover .sinal:after, .mais-btn.hvd .sinal:after {
    -webkit-transition-duration: .6s;
    transition-duration: .6s;
}

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

Veja o Resultado baixo!

Baixar Código Veja Funcionando

Publicado por: Loop Nerd

199 Visualizações

Deixe um comentário

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

Artigos Relacionados