css 实现鼠标上移添加下划线

效果图

css 实现鼠标上移添加下划线_第1张图片

实现代码

<!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>Document</title>
  <style>
    .title {
      color: #333;
    }

    .title span {
      background: linear-gradient(to right, #999, #999) no-repeat right bottom;
      background-size: 0 2px;
      transition: background-size 1000ms;
    }

    .title span:hover {
      background-position-x: left;
      background-size: 100% 2px;
    }
  </style>
</head>

<body>
  <h2 class="title">
    <span>
      Migrating From MySQL to YugabyteDB Using YugabyteDB VoyagerMigrating From MySQL to YugabyteDB Using</span>
  </h2>
</body>

</html>

你可能感兴趣的:(css,前端)