Snippets: Hover Effect 002
* { outline: none; box-sizing: border-box; } html, body { width: 100vw; height: 100vh; font-size: 18px; color: #333; } body { background: white; }
CSS Before Head
HTML Head
a { overflow: hidden; position: relative; display: inline-block; } a::before, a::after { content: ''; position: absolute; width: 100%; left: 0; } a::before { background-color: #54b3d6; height: 2px; bottom: 0; transform-origin: 100% 50%; transform: scaleX(0); transition: transform .3s cubic-bezier(0.76, 0, 0.24, 1); } a::after { content: attr(data-replace); height: 100%; top: 0; transform-origin: 100% 50%; transform: translate3d(200%, 0, 0); transition: transform .3s cubic-bezier(0.76, 0, 0.24, 1); color: #54b3d6; } a:hover::before { transform-origin: 0% 50%; transform: scaleX(1); } a:hover::after { transform: translate3d(0, 0, 0); } a span { display: inline-block; transition: transform .3s cubic-bezier(0.76, 0, 0.24, 1); } a:hover span { transform: translate3d(-200%, 0, 0); } /* Presentational Styles */ body { display: grid; font-family: 'Poppins', sans-serif; font-size: 27px; line-height: 1.5; height: 100vh; place-items: center; } a { text-decoration: none; color: #18272F; font-weight: 700; vertical-align: top; }
CSS After Head
JS Before HTML Body
<p>Hover <a href="#" id="style-2" data-replace="this link"><span>this link</span></a></p>
HTML Body
HTML Foot
JS After HTML Body
Full HTML Code