-1

I'm pretty new learning html/css and I'm having some issues about transitions on hovering, what im looking for is to have a transition back to the initial state while not hovering, I do not like that when I release the mouse and it returns abruptly

CSS

.btn {
    cursor: pointer;
    display: inline-inline-block;
    border: 0;
    font-weight: bold;
    padding: 10px 20px;
    background: #262626;
    color: #ffffff;
    font-size: 15px;
    border-radius: 0.31em;
    margin: 10px 0px;
    opacity: .4;
}

.btn:hover {
    background-color:rgba(26,26,26,.4);
  box-shadow: 0 0 0 3px rgba(53, 37, 152, 0.5);
    transition: .8s;
}

HTML

   <a href="#" class="btn">Leer más <i class="fas fa-angle-double-right"></i></a>

please be patient at me ahaha

Thank all of u

2 Answers2

4

Add transition: .8s; for .btn and not for .btn:hover.

Felix A J
  • 6,300
  • 2
  • 27
  • 46
0

I have implemented Felix AJ response and it works 100%.

.btn {
    cursor: pointer;
    display: inline-inline-block;
    border: 0;
    font-weight: bold;
    padding: 10px 20px;
    background: #262626;
    color: #ffffff;
    font-size: 15px;
    border-radius: 0.31em;
    margin: 10px 0px;
    opacity: .4;
    transition: .8s;
    
}

.btn:hover {
    background-color:rgba(26,26,26,.4);
  box-shadow: 0 0 0 3px rgba(53, 37, 152, 0.5);
  
    
}
<!DOCTYPE html>
<html>
<head>
</head>
<body>


 <a href="#" class="btn">Leer más <i class="fas fa-angle-double-right"></i></a>

</body>
</html>
Weyers de Lange
  • 280
  • 2
  • 11