Folding Card Animation
Home
Snippets
Folding Card Animation
HTML
CSS
JS
<div class="container"> <div class="task"> <div class="abstract"> <h3>Abstract</h3> <p>This is what you see by default.</p> </div> <div class="details"> <div class="details__inner"> <h3>Details</h3> <p>This additional content gets revealed on hover.</p> </div> </div> </div> </div>
body { margin: 0; height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(to left, #ff512f, #dd2476); color: #282828; } .container{ display: flex; justify-content: center; flex-wrap: wrap; height: 300px; gap: 30px; padding: 0 70px } .task { position: relative; overflow: hidden; cursor: pointer; perspective: 800px; transform-style: preserve-3d; } .abstract, .details { width: 100%; padding: 15px 30px; position: relative; background: rgba(255, 255, 255, 1); transition: 0.3s ease all; } .task:hover .abstract, .task:hover .details { background: rgba(250, 250, 250, 1); } .details { max-height: 0; padding: 0; overflow: hidden; visibility: hidden; transform: rotateX(-180deg); transform-origin: top center; backface-visibility: hidden; transition: 0.3s transform ease; } .task:hover .details { max-height: none; overflow: visible; visibility: visible; transform: rotateX(0deg); } .details__inner { padding: 15px 30px; } .details:before { content: ''; display: block; position: absolute; top: 0; left: 10%; right: 10%; height: 1px; background: grey; }
// JavaScript
Ad #1
Ad #2
Scroll to Top