Flip Card using HTML & CSS

Following code used to create an interactive flip card

HTML Code:

Build the basic structure of card

<!DOCTYPE html>
<!-- code by CodeitHub ( https://CodeitHub.com ) -->
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title>Flip Card</title>
    <link rel="stylesheet" href="main.css">
    <script src="https://kit.fontawesome.com/a076d05399.js"></script>
  </head>
  <body>
    <div class="wrapper">
      <div class="card2 front-face">
        <img src="card2.jpg">
      </div>
<div class="card2 back-face">
        <img src="card2.jpg">
        <div class="info">
          <div class="title">
Codeithub</div>
<p>
Profile Card<br>Flip</p>
</div>
<ul>
          <a href="#"><i class="fab fa-facebook-f"></i></a>
          <a href="#"><i class="fab fa-twitter"></i></a>
          <a href="#"><i class="fab fa-instagram"></i></a>
          <a href="#"><i class="fab fa-youtube"></i></a>
        </ul>
</div>
</div>
</body>
</html>

CSS Code:

CSS code change the look and feel of your flip card 

<!-- code by CodeitHub ( https://CodeitHub.com ) -->
@import url('https://fonts.googleapis.com/css2?family=Montserrat:[email protected];700&display=swap');
*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Montserrat', sans-serif;
}
html,body{
  display: grid;
  height: 100%;
  width: 100%;
  place-items: center;
}
::selection{
  color: #fff;
  background: #181547;
}
.wrapper{
  height: 400px;
  width: 320px;
  position: relative;
  transform-style: preserve-3d;
 perspective: 1000px;
}
.wrapper .card2{
  position: absolute;
  height: 100%;
  width: 100%;
  padding: 5px;
  background: linear-gradient(388deg, #181547, #edf1f0);
  border-radius: 10px;
  transform: translateY(0deg);
  transform-style: preserve-3d;
  backface-visibility: hidden;
  box-shadow: 0px 10px 15px rgba(0,0,0,0.1);
  transition: transform 0.7s cubic-bezier(0.4,0.2,0.2,1);
}
.wrapper:hover > .front-face{
  transform: rotateY(-180deg);
}
.wrapper .card2 img{
  height: 100%;
  width: 100%;
  object-fit: cover;
  border-radius: 10px;
}
.wrapper .back-face{
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  flex-direction: column;
  transform: rotateY(180deg);
}
.wrapper:hover > .back-face{
  transform: rotateY(0deg);
}
.wrapper .back-face img{
  height: 150px;
  width: 150px;
  padding: 5px;
  border-radius: 50%;
  background: #181547;
}
.wrapper .back-face .info{
  text-align: center;
}
.back-face .info .title{
  font-size: 30px;
  font-weight: 500;
}
.back-face ul{
  display: flex;
}
.back-face ul a{
  display: block;
  height: 40px;
  width: 40px;
  color: #fff;
  text-align: center;
  margin: 0 5px;
  line-height: 38px;
  border: 0.1px solid transparent;
  border-radius: 70%;
  background: #181547;
  transition: all 0.5s ease;
}
.back-face ul a:hover{
  color: #181547;
  border-color: #181547;
  background: linear-gradient(355deg, transparent, transparent);
}
See also  Accordion Menu using HTML & CSS

Leave a Reply