Flip Card

ホバーで裏返る3Dカードアニメーション。
CSS 3D Transforms の transform-style と backface-visibility を活用した実装です。

Demo

HTML index.html

<!DOCTYPE html>
<html lang="ja">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Flip Card</title>
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <div class="flip-card">
    <div class="flip-card-inner">
      <div class="flip-card-front">
        <h2>Front</h2>
        <p>Hover to flip</p>
      </div>
      <div class="flip-card-back">
        <h2>Back</h2>
        <p>CSS 3D Transform</p>
      </div>
    </div>
  </div>
</body>
</html>

CSS style.css

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #2d3436;
}

.flip-card {
  width: 280px;
  height: 360px;
  perspective: 1000px;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  border-radius: 16px;
  padding: 32px;
}

.flip-card-front {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.flip-card-back {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  transform: rotateY(180deg);
}

h2 {
  font-size: 32px;
  font-weight: 700;
}

p {
  font-size: 16px;
  opacity: 0.9;
}

Download

すべてのファイルをZIP形式でダウンロードできます。