DEV Community

Cover image for Add Flip Card in your Project
Anoop Patel
Anoop Patel

Posted on

Add Flip Card in your Project

Add Flip card effect in your project just copy and paste the code..

HTML

<!DOCTYPE html>
<html lang="en">
<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>



  <!-- Projects Section -->
  <section class="projects">
    <div class="container">
      <h2 class="section-title">My Projects</h2>
      <div class="projects-grid">
        <div class="project-card">
          <div class="card-inner">
            <div class="card-front">
              <img src="qw.jpg" alt="Project 1">
              <h3>Project One</h3>
            </div>
            <div class="card-back">
              <p>A MERN stack application with real-time features and dynamic design.</p>
              <a href="#" class="cta">View Project</a>
            </div>
          </div>
        </div>
        <div class="project-card">
          <div class="card-inner">
            <div class="card-front">
              <img src="qw.jpg" alt="Project 2">
              <h3>Project Two</h3>
            </div>
            <div class="card-back">
              <p>An Android app featuring modern UI/UX and seamless functionality.</p>
              <a href="#" class="cta">View Project</a>
            </div>
          </div>
        </div>
        <div class="project-card">
          <div class="card-inner">
            <div class="card-front">
              <img src="qw.jpg" alt="Project 3">
              <h3>Project Three</h3>
            </div>
            <div class="card-back">
              <p>A creative portfolio showcasing animations and responsive design.</p>
              <a href="#" class="cta">View Project</a>
            </div>
          </div>
        </div>
      </div>
    </div>
  </section>



</body>
</html>

Enter fullscreen mode Exit fullscreen mode

CSS

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

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    scroll-behavior: smooth;
}



/* Projects Section */
.projects {
    padding: 50px 20px;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.project-card {
    perspective: 1000px;
    height: 200px;
}

.card-inner {
    transition: transform 0.8s;
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

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

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    overflow: hidden;
}

.card-front {
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.card-back {
    background: #2575fc;
    color: #fff;
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}


Enter fullscreen mode Exit fullscreen mode

Top comments (0)