a.button(href="#") BUTTON1
a.button(href="#") BUTTON2
a.button(href="#") BUTTON3
a.button(href="#") BUTTON4
View Compiled
$duration: .5s;

@mixin reverse ($o, $s) {
  transition: transform $duration;
  transform-origin: $o;
  transform: $s;
}

html,body {
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.button {
  position: relative;
  display: inline-block;
  padding: 15px 40px;
  margin: 0 10px;
  border: 2px solid #222;
  text-decoration: none;
  color: #222;
  font-family: sans-serif;
  font-size: 24px;
  letter-spacing: 4px;
  transition: $duration;
  &::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
  }
  &:nth-child(1):after {
    background-color: #0BBDA2;
    @include reverse(right, scaleX(0));
  }
  &:nth-child(2):after {
    background-color: #E69922;
    @include reverse(left, scaleX(0));
  }
  &:nth-child(3):after {
    background-color: #5669A1;
    @include reverse(top, scaleY(0));
  }
  &:nth-child(4):after {
    background-color: #EF4249;
    @include reverse(bottom, scaleY(0));
  }
  &:hover {
    color: #FFF;
    &:nth-child(1):after {
      @include reverse(left, scaleX(1));
    }
    &:nth-child(2):after {
      @include reverse(right, scaleX(1));
    }
    &:nth-child(3):after {
      @include reverse(bottom, scaleY(1));
    }
    &:nth-child(4):after {
      @include reverse(top, scaleY(1));
    }
  }
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.