Text highlight on hover.

text

Highlight text on hover.

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
    <link rel="stylesheet" href="style.css">
    <style type="text/css">
    body{
  margin: 0;
  padding: 0;
  font-family: "montserrat",sans-serif;
}
.middle{
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
}

.container{
  position: relative;
  display: inline-block;
  padding: 0 40px;
  cursor: pointer;
}

.text{
  font-size: 100px;
  text-transform: uppercase;
  font-weight: 900;
  position: relative;
  color: #34495e;
}
.text::before{
  content: attr(data-text);
  position: absolute;
  color: #fff;
  width: 0;
  overflow: hidden;
  transition: 0.6s;
}
.container::before{
  content: "";
  width: 0%;
  height: 100%;
  position: absolute;
  background: #2980b9;
  right: 0;
  top: 0;
  transition: 0.6s;
}
.container:hover .text::before,
.container:hover::before{
  width: 100%;
}

    </style>
  </head>
  <body>

  <div class="middle">
    <span class="container">
      <div class="text" data-text="Rahul">Rahul</div>
    </span>
  </div>

  </body>
</html>