Animated multi-line underline
How do I make an animated multi-line underline?
Animating a pseudo element "underline" (.sad-link) to full height on hover works great for short links and breaks for multiline links. Here's a solution, .happy-link!. What is a animated multi-line underline? How do you make a animated multi-line underline? This script and codes were developed by Eli Fitch on 28 October 2022, Friday.
Animated multi-line underline - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Animated multi-line underline</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ body { padding: 4em;
}
.container { width: 250px; margin-bottom: 2em;
}
a { font-family: helvetica; font-size: 3em; text-decoration: none;
}
.sad-link { position: relative; display: inline-block; color: #444;
}
.sad-link:after { content: ''; position: absolute; z-index: -1; bottom: -0.15em; left: -.15em; width: calc(100% + .3em); height: 0.15em; background: #FF44FF; transition: all .2s;
}
.sad-link:hover:after { height: calc(100% + 0.3em);
}
.happy-link { line-height: 1.15; transition: background-position 0.15s linear 0.1s, box-shadow 0.15s linear 0s; background-image: linear-gradient(to bottom, #FF44FF 0%, #FF44FF 100%); background-size: 100%; background-repeat: no-repeat; background-position: 0 1em; color: #444; overflow: hidden;
}
.happy-link:hover { cursor: pointer; background-image: linear-gradient(to bottom, #FF44FF 0%, #FF44FF 100%); background-position: 0 0em; box-shadow: 0.2em 0 0 #FF44FF, -0.2em 0 0 #FF44FF; transition: background-position 0.1s linear 0s, box-shadow 0.1s linear 0.1s;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <div class="container"> <a class="sad-link">A sad multiline link :(</a> <br><br><br> <a class="happy-link">A happy multiline link :)</a>
</div>
<a class="sad-link">:( short link</a>
<br><br><br>
<a class="happy-link">:) short link</a>
</body>
</html>
Animated multi-line underline - Script Codes CSS Codes
body { padding: 4em;
}
.container { width: 250px; margin-bottom: 2em;
}
a { font-family: helvetica; font-size: 3em; text-decoration: none;
}
.sad-link { position: relative; display: inline-block; color: #444;
}
.sad-link:after { content: ''; position: absolute; z-index: -1; bottom: -0.15em; left: -.15em; width: calc(100% + .3em); height: 0.15em; background: #FF44FF; transition: all .2s;
}
.sad-link:hover:after { height: calc(100% + 0.3em);
}
.happy-link { line-height: 1.15; transition: background-position 0.15s linear 0.1s, box-shadow 0.15s linear 0s; background-image: linear-gradient(to bottom, #FF44FF 0%, #FF44FF 100%); background-size: 100%; background-repeat: no-repeat; background-position: 0 1em; color: #444; overflow: hidden;
}
.happy-link:hover { cursor: pointer; background-image: linear-gradient(to bottom, #FF44FF 0%, #FF44FF 100%); background-position: 0 0em; box-shadow: 0.2em 0 0 #FF44FF, -0.2em 0 0 #FF44FF; transition: background-position 0.1s linear 0s, box-shadow 0.1s linear 0.1s;
}
Developer | Eli Fitch |
Username | elifitch |
Uploaded | October 28, 2022 |
Rating | 4.5 |
Size | 3,247 Kb |
Views | 68,816 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Diagonal gradient fill button | 4,860 Kb |
Smiley guy | 3,845 Kb |
Vanilla JS sticky header | 1,944 Kb |
Mars | 3,817 Kb |
Slanty Button Mixin | 4,109 Kb |
Flexslider thumbnail modification | 13,431 Kb |
Animated SVG Hexagon | 3,470 Kb |
Goodbye 2016 | 5,786 Kb |
Animated multi-line underline | 3,247 Kb |
Batman Middle Finger | 3,152 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
CSS Parent Selector | Tomhodgins | 2,143 Kb |
Spin | Elalemanyo | 8,262 Kb |
Word Wrap Algorithm for Multiline Canvas Text | Peterhry | 2,349 Kb |
Pure CSS Read More Arrow | Zephyr | 1,747 Kb |
A Pen by Oliver Schafeld | Schafeld | 1,720 Kb |
CSS Bot Confusion | Jpod | 3,456 Kb |
A Pen by Anoop | Anoopjohn | 330,760 Kb |
RWD- Mostly Fluid Layout Pattern | Marcocastro | 2,312 Kb |
Social buttons | Flacu | 2,022 Kb |
Hexagons | Ashmind | 4,360 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!