Created
January 27, 2023 16:31
-
-
Save nezvinskyi/b8390ca5dad55be83d467ea2172e01a8 to your computer and use it in GitHub Desktop.
Underline on hover CSS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Gists</title> | |
<link rel="stylesheet" href="styles/styles.css" /> | |
<style> | |
.underline { | |
display: inline-block; | |
background: linear-gradient(to right, transparent, transparent), | |
linear-gradient(to right, #ff0000, #fff200, #1e9600); | |
background-size: 100% 3px, 0 3px; | |
background-position: 100% 100%, 0 100%; | |
background-repeat: no-repeat; | |
transition: background-size 400ms; | |
} | |
.underline:hover { | |
background-size: 0 3px, 100% 3px; | |
} | |
</style> | |
</head> | |
<body> | |
<h1 class="underline">Underline text</h1> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment