I’m trying desperately to create an animation similar to this gif on my links.
I’m using the following html (elementor on wordpress):
<a href="#" class="elementor-button-link elementor-button elementor-size-sm">
<span class="elementor-button-content-wrapper">
<span class="elementor-button-icon elementor-align-icon-left">
<i aria-hidden="true" class="icon icon-arrow"></i>
</span>
<span class="elementor-button-text">Say Hello</span>
</span>
</a>
The span elementor-button-icon contains my icon.
Here is the CSS:
a span.elementor-button-content-wrapper { position: relative;}
a span.elementor-button-content-wrapper:before {
content: "";
position: absolute;
width: 0;
height: 1px;
bottom: -5px;
left: 0;
background-color: #0D4BDE;
visibility: hidden;
transition: all 0.3s ease-in-out;
}
a:hover span.elementor-button-content-wrapper:before {
visibility: visible;
width: 100%;
}
a span.elementor-button-icon {visibility:hidden;opacity:0;transition:all .2s ease}
a span.elementor-button-text {transition:all .2s ease;}
a:hover span.elementor-button-text {transform:translateX(15px);}
a:hover span.elementor-button-icon {opacity:1;visibility:visible;}
but this is not the right result at all. I searched everywhere on the web, but I didn’t find anything.
A genius among us?
2
Answers
I don’t know about Elementor, but in
css
, you could do something as the example below, it should get you started in achieving your goal.You can tweak the following. The Arrow (
overflow: hidden
) and underline expands from 0 width and goes to 24px and 100% of parents width respectively: