<div class="square">
  <div class="text"><span>Hover Me</div>
</div>
body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

.square {
  position: relative;
  width: 250px;
  height: 80px;
  border: 7px solid #333;  
  box-shadow: 10px 10px rgba(0,0,0,0.5);
}

.square:before {
  position: absolute;
  content:"";
  width: 0px;
  height: 80px;
  background-color: #333;
  transition: width .5s ease;
}

.square:hover:before {
  width: 250px;
}
.text {
  position: relative;
  font-size:50px;
  color: #333;
  font-family: Tahoma, sans-serif;
  text-align: center;
  margin:7px;
}

.square:hover .text:before {
  content:"Thanks!";
  color: #fff;
}

.square:hover span {
  display: none;
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.