Underline Slide Effect
CSS
Medium
2 views
Problem Description
Create a link underline that slides in on hover.
Output Format
Print the HTML+CSS code in one block.
Constraints
Use background-size or pseudo element with transition.
Official Solution
<!doctype html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<title>meetcode</title>
<style>
a { color: #124; text-decoration: none; background-image: linear-gradient(#0b5, #0b5); background-repeat: no-repeat; background-position: 0 100%; background-size: 0 2px; transition: background-size 200ms ease; }
a:hover { background-size: 100% 2px; }
</style>
</head>
<body>
<a href='#'>Open meetcode topics</a>
</body>
</html>
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!