CSS Flip Card Hover Effects

Web Design & Web Development

Demo

Sponsored links

 

Code

HTML

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>CSS Flip Card Hover Effect</title>
    <link rel="stylesheet" type="text/css" href="https://demo.plantpot.works/assets/css/normalize.css">
    <link rel="stylesheet" href="https://use.typekit.net/opg3wle.css">
    <link rel="stylesheet" type="text/css" href="style.css">
  </head>
  <body>
    <div id="container">
      <div class="card">
        <div class="card-content front">
          <img src="logo.png" alt="logo">
        </div>
        <div class="card-content back">
          <p>https://plantpot.works</p>
          <div class="sns-images">
            <img src="twitter.svg" alt="icon_twitter">
            <img src="instagram.svg" alt="icon_instagram">
            <img src="pinterest.svg" alt="icon_pinterest">
            <img src="youtube.svg" alt="icon_youtube">
          </div>
        </div>
      </div>
    </div>
  </body>
</html>

CSS

@charset "utf-8";
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 16px;
}
body {
  background-color: #3d3935;
  font-family: futura-pt, sans-serif;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}
#container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100vh;
}
.card {
  position: relative;
  transform-style: preserve-3d;
  width: 280px;
  height: 280px;
}
.card-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  position: absolute;
  top: 0;
  left: 0;
  transform-style: preserve-3d;
  width: 100%;
  height: 100%;
  transition: 1.5s ease-in-out;
}
.front {
  background-color: #fff9de;
}
.back {
  transform: perspective(500px) rotateY(180deg);
  background-color: #fff;
}
.front img,
.back img,
.back p {
  transform: perspective(500px) translateZ(50px);
}
.sns-images {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
}
.front img {
  width: 120px;
}
.back p {
  color: #3d3935;
  font-size: 1.25rem;
}
.back img {
  width: 20px;
  margin: 0 10px;
}
.card:hover .front {
  transform: perspective(500px) rotateY(180deg);
}
.card:hover .back {
  transform: perspective(500px) rotateY(360deg);
}