S
S
sgn_crazushot2018-02-16 10:16:49
css
sgn_crazushot, 2018-02-16 10:16:49

How to make text move on hover?

Hello)
How to implement this idea:
With a sufficiently long text in a narrow and not high block, where only the
first words will be visible, and those that are further will be hidden, then on hover the title will be shown from edge to edge, in
order to better understand what I mean , found a similar effect on the video:
https://youtu.be/MUc2KlzGgvE

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sherzod Axmedov, 2018-02-16
@iamaxmedovv256

Option 1

HTML:
@-webkit-keyframes scroll {
    0% {
        -webkit-transform: translate(0, 0);
        transform: translate(0, 0);
    }
    100% {
        -webkit-transform: translate(-100%, 0);
        transform: translate(-100%, 0)
    }
}

@-moz-keyframes scroll {
    0% {
        -moz-transform: translate(0, 0);
        transform: translate(0, 0);
    }
    100% {
        -moz-transform: translate(-100%, 0);
        transform: translate(-100%, 0)
    }
}

@keyframes scroll {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(-100%, 0)
    }
}

.marquee {
    display: block;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
}

.marquee > span:hover {
    display: inline-block;
    padding-left: 100%;
    -webkit-animation: scroll 15s infinite linear;
    -moz-animation: scroll 15s infinite linear;
    animation: scroll 15s infinite linear;
}

A
aloky, 2018-02-16
@aloky

Something like this) just need to finish the job))) https://codepen.io/aloky/pen/ddZdZR

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question