【CSS】ボタンホバー時にカラーをカーテンのようにスライドアニメーションさせて変更する方法(JavaScript不使用)のデモページ

※デベロッパーツール等でソースコードをご確認ください(Please check using Developer tools)

このページの内容が難しいと感じた方はこちら

スポンサーリンク

Web制作会社LIGが運営するWebデザインスクール

CSS

.list {
  display: flex;
  justify-content: space-between;
  width: 768px;
  margin: 70px auto 0;
}

.list li {
  width: 30%;
  transition: all 0.5s ease;
  background: #000;
  border: #000 solid 2px;
}

.list li a {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  padding: 25px 0;
  font-size: 12px;
}

.list li a div {
  position: absolute;
  top: 0;
  width: 100%;
  height: 100%;
  text-align: center;
}

.list li a div:nth-child(1) {
  top: 50%;
  line-height: 0;
  color: #fff;
  background: #000;
}

.list li a div:nth-child(2) {
  width: 120%;
  transition: all 0.2s ease;
  transform: translate(-120%, 0px) skewX(-30deg);
  background: #fff;
}

.list li a div:nth-child(3) {
  top: 50%;
  left: -120%;
  line-height: 0;
  transition: left 0.2s ease;
  color: #000;
}

.list li a:hover div:nth-child(2) {
  transition: all 0.5s ease;
  transform: translate(-15px, 0px) skewX(-30deg);
}

.list li a:hover div:nth-child(3) {
  left: 0px;
  transition: left 0.3s ease;
}

@media screen and (max-width:640px){
  .list {
    width: 100%;
  }
}