'How to solve the problem of button flickering caused by css transition?

I have seen some solutions but they actually affect the design intended. Is there any way to stop this flicker without altering the design? I understand that the problem is that While hovering over a moving (or animated) element, it may just un-hover from the element because it moves beneath my cursor.

    <!DOCTYPE html>
<html>
<head>
<style>
body{
 background-color: #FFEE32;
}
.button {
box-shadow: -10px 10px;
    background-color: #FFEE32;
    border: 3px solid;
    display: inline-block;
    cursor: pointer;
    color: #202020;
    font-size: 30px;
    font-weight: bold;
    padding: 20px 30px;
      transition: all 0.15s linear 0s;
    text-decoration: none;
    position: relative;
    box-sizing: border-box;
    
}

.button:hover {
    top: 3px;
      transition: all 0.15s linear 0s;
    left: -3px;
    color: #FFEE32;
    background-color: #202020;
    border: #FFEE32;
    box-shadow: 0px 0px 0 #ffe800 !important;
    position: relative;

}

</style>
</head>
<body>

<h2>Animated Button - "Pressed Effect"</h2>
<div class="see">
<button class="button">Click Me</button>
</div>
</body>
</html>

check it out here, try to hover on edges from right and bottom



Solution 1:[1]

because of border size & top,left position button is "flickering" when hover on corner side.

Add "3px" in border & remove "top & left" position.

<!DOCTYPE html>
<html>
<head>
<style>
body{
 background-color: #FFEE32;
}
.button {
box-shadow: -10px 10px;
    background-color: #FFEE32;
    border: 3px solid;
    display: inline-block;
    cursor: pointer;
    color: #202020;
    font-size: 30px;
    font-weight: bold;
    padding: 20px 30px;
      transition: all 0.15s linear 0s;
    text-decoration: none;
    position: relative;
    box-sizing: border-box;
    
}

.button:hover {
    top: 0px;
      transition: all 0.15s linear 0s;
    left: 0px;
    color: #FFEE32;
    background-color: #202020;
    border:3px solid #FFEE32;
    box-shadow: 0px 0px 0 #ffe800 !important;
    position: relative;

}

</style>
</head>
<body>

<h2>Animated Button - "Pressed Effect"</h2>
<div class="see">
<button class="button">Click Me</button>
</div>
</body>
</html>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Satish Modha