コピペOK!

Webコーディング帳

背景がジュワッと広がる

Button

HTML

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

CSS

            
.anime-juwa {
  position: relative;
  overflow: hidden;
  transition: color 0.3s ease;
}
.anime-juwa::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0%;
  height: 0%;
  background: rgba(255, 208, 100, 1);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  transition: width 0.5s ease, height 0.5s ease;
  z-index: 0;
}
.anime-juwa:hover::before {
  width: 300%;
  height: 300%;
}
.anime-juwa span {
  position: relative;
  z-index: 2;
}
// ボタンのスタイル
.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;
}