【发布时间】:2021-04-01 16:20:56
【问题描述】:
如何在移动设备上获得翻转效果?它在 pc 上运行良好,因为我使用 :hover 伪选择器,但在移动设备上它只会翻转一次,并且只有在单击另一张卡片时才会翻转。如何在手机和平板上实现全翻转效果?
.flip-card {
background-color: transparent;
width: 300px;
height: 300px;
perspective: 1000px;
margin: 2%;
}
.flip-card-inner {
position: relative;
width: 100%;
height: 100%;
text-align: center;
transition: transform 0.6s;
transform-style: preserve-3d;
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
}
.flip-card:hover .flip-card-inner {
transform: rotateY(180deg);
}
.flip-card-front, .flip-card-back {
position: absolute;
width: 100%;
height: 100%;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}
.flip-card-front {
background-color: #bbb;
color: white;
}
.flip-card-back {
background-color: #2980b9;
color: white;
transform: rotateY(180deg);
}
.preiposle{
display: flex;
justify-content: space-evenly;
padding-top: 50px;
position: relative;
text-align: center;
color: white;
flex-wrap: wrap;
}
【问题讨论】:
-
您希望它何时翻转?另外,请同时发布html。
标签: html css hover responsive flip