Snippet 20 : Hover Effect Button – 20

Snippet akan menggunakan border untuk melakukan effect swipe.

<a href="#">button</a>
body {
  height: 100vh;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
}

a {
  text-decoration: none;
  position: relative;
  width: 250px;
  height: 80px;
  text-align: center;
  line-height: 80px;
  color: #250e74;
  border: 4px solid #250e74;
  font-size: 24px;
  letter-spacing: 3px;
  text-transform: uppercase;
  transition: all 0.5s;
  overflow: hidden;
}

a:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  border-top: 40px solid #250e74;
  border-bottom: 40px solid #250e74;
  border-right: 40px solid transparent;
  transition: all 0.5s;
  z-index: -1;
  transform: translateX(-100%);
}

a:hover:before {
  transform: translateX(0%);
}

a:after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  border-top: 40px solid #250e74;
  border-bottom: 40px solid #250e74;
  border-left: 40px solid transparent;
  transition: all 0.5s;
  z-index: -1;
  transform: translateX(100%);
}

a:hover:after {
  transform: translateX(0%);
}

a:hover {
  color: white;
}
Sharing is caring:

Leave a Comment