0
*{
    margin: 0;
    padding: 0;
}

body{
    background-color: lightgray;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
}

@keyframes background-scroll-left{
    0%{
        background-position-x: 0%;
    }
    100%{
        background-position-x: -200%;
    }
}

h1{
    display: flex;
    justify-content: center;
    align-items: center;
    height: 150px;
    width: 100vw;
    color: grey;
    background-size: 200%;
    transition: all 1s ease;
    animation: background-scroll-left 2s linear infinite;
}

h1:hover{
    background: linear-gradient(to right, yellow, red, yellow);
}
<h1>Hello World</h1>

basically whats happening is i made the tranisiotn time 1 second but when i hover over the text the background appears straight away like instantly and i want it to take 1 second to appear

i tried rearranging some code but nothing worked at all

0 Answers0