console
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hover Underline Effect</title>
<style>
.multiline-effect {
display: inline;
background: linear-gradient(#3498db, #3498db) no-repeat;
background-size: 0% 1px;
background-position: left 100%;
transition: background-size 0.3s ease;
box-decoration-break: clone;
-webkit-box-decoration-break: clone;
padding-bottom: 2px;
}
.multiline-effect:hover {
background-size: 100% 1px;
}
</style>
</head>
<body>
<div class="multiline-effect">
如果希望整段文字的下划线动画按行独立触发,可以使用 box-decoration-break: clone。悬停时,每一行都会出现从两边向中间展开的下划线动画效果。
</div>
</body>
</html>