HTML结构
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | < div class = "scene" > < div class = "card" > < div class = "card__face card__face--front" > < img src = "img/t1.png" /> </ div > < div class = "card__face card__face--back" > < img src = "img/t1a.png" /> </ div > </ div > < div class = "card" > < div class = "card__face card__face--front" > < img src = "img/t2.png" /> </ div > < div class = "card__face card__face--back" > < img src = "img/t2a.png" /> </ div > </ div > < div class = "card" > < div class = "card__face card__face--front" > < img src = "img/t3.png" /> </ div > < div class = "card__face card__face--back" > < img src = "img/t3a.png" /> </ div > </ div > </ div > |
CSS样式
初始化时隐藏窗口内容。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | body { display : flex; justify- content : center ; align-items: center ; height : 100 vh; background : black ; } .scene { width : 1000px ; display : flex; justify- content : space-between; -webkit-perspective: 800px ; perspective: 800px ; } .scene .card { position : relative ; width : 240px ; height : 300px ; color : white ; cursor : pointer ; transition: 1 s ease-in-out; -webkit-transform-style: preserve -3 d; transform-style: preserve -3 d; } .scene .card:hover { -webkit-transform: rotateY( 0.5 turn); transform: rotateY( 0.5 turn); } .scene .card .card__face { position : absolute ; top : 0 ; left : 0 ; width : 100% ; height : 100% ; -webkit-backface- visibility : hidden ; backface- visibility : hidden ; transition: 1 s ease-in-out; -webkit-box-reflect: below 0 linear-gradient( transparent , transparent , rgba( 0 , 0 , 0 , 0.4 )); } .scene .card .card__face img { width : 240px ; height : 300px ; -o-object-fit: cover; object-fit: cover; } .scene .card .card__face--back { -webkit-transform: rotateY( 0.5 turn); transform: rotateY( 0.5 turn); } |
特别申明:
本站所有资源都是由网友投稿发布,或转载各大下载站,请自行检测软件的完整性!
本站所有资源仅供学习与参考,请勿用于商业用途,否则产生的一切后果将由您自己承担!
如有侵权请联系我们删除下架,联系方式:lei1294551502@163.com