コピペOK!

Webコーディング帳

色が変わるver3

Button

HTML

            
<div class="btn anime-hanten3">
  <span>Button</span>
</div>             
        

CSS

            
.anime-hanten3 {
  overflow: hidden;
  position: relative;
  z-index: 1;
}
.anime-hanten3::after {
  background: #4B321B;
  position: absolute;
  top: 0;
  left: 0;
  content: '';
  width: 100%;
  height: 250%;
  transform: skewY(-15deg) scale(1, 0);
  transform-origin: left top;
  transition: .3s cubic-bezier(0.45, 0, 0.55, 1);
  z-index: -1;
}
.anime-hanten3:hover {
  color: #FFFA8B;
}
.anime-hanten3:hover::after {
  transform: skewY(-15deg) scale(1, 1);
}
// ボタンのスタイル
.btn {
  background-color: #eb6100;
  width: 240px;
  height: 54px;
  border-radius: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  margin: 0 auto;
  box-shadow: 0px 4px 4px rgba($color: #000000, $alpha: .16);
  cursor: pointer;
  color: #fff;
}