CSS3实现漂亮的卡片翻转效果

时间:2025-04-05 19:14:51
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="Content-Type" content="text/html"> <meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no"> <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> <title>CSS3实现卡片翻转效果</title> <style> .re-item { width: 220px; margin: 50px auto; height: 276px; cursor: pointer; position: relative; perspective: 500; -webkit-perspective: 500; } .re-item img { max-width: 220px; } .re-item-front, .re-item-back { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: #fff; -webkit-perspective: 1000; /*backface-visibility: hidden;*/ -webkit-transition: all 1.5s; -moz-transition: all 1.5s; -ms-transition: all 1.5s; -o-transition: all 1.5s; box-shadow: rgba(50, 50, 50, 0.2) 0 0 15px; overflow: hidden; } .re-item-back { position: relative; transform: rotateY(-180deg); -webkit-transform: rotateY(-180deg); } .re-item:hover .re-item-front { transform: rotateY(-180deg); -webkit-transform: rotateY(-180deg); } .re-item:hover .re-item-back { transform: rotateY(-360deg); -webkit-transform: rotateY(-360deg); } .re-box .re-item dd { text-align: center; font-family: "微软雅黑"; } .re-item .re-item-job { margin: 2px 0; font-size: 18px; color: #303030; line-height: 40px; } .re-item .re-item-des { padding: 0 12px; font-size: 14px; color: #939393; } </style> </head> <body> <div class="re-box"> <div class="re-item"> <dl class="re-item-front"> <dt><img src="img/" / alt="coser"></dt> <dd class="re-item-job">coser</dd> <dd class="re-item-des">成为我们的合作coser,漫展返图,*扩列,以及无偿拍摄&后期服务</dd> </dl> <div class="re-item-back"> <img src="img/c2_1.jpg" alt="苏苏" /> <button type="button" class="join_btn open_modal" data-id="2">立即加入</button> </div> </div> </div> </body> </html>