body {
    background: linear-gradient(90deg, purple, orangered);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
}
.button, .button2 {
    background: black;
    padding: 30px 60px;
    color: white;
    border-radius: 5px;
    text-transform: uppercase;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    z-index: 1;
    margin: 0 15px;
}

.button::before {
    content: '';
    position: absolute;
    top: 0;
    background: lime;
    left: -95%;
    width: 100%;
    height: 100%;
    z-index: -1;
    transition: .3s ease-in-out;
}
.button:hover:before, .button2:hover::before {
    left: 0;
}
.button2::before{
    content: '';
    position: absolute;
    left: 95%;
    top: 0;
    background: skyblue;
    width: 100%;
    height: 100%;
    z-index: -1;
    transition: .3s ease-in-out;
}
