卡片组翻转在旧浏览器中不起作用
card deck flip not working in old browser
之前没有尝试过制作翻页卡片,但对 CSS 非常陌生,所以我正在努力修改网上找到的代码以满足我的需要,然后让它在 IE 上运行,有人可以指点我吗方向正确吗?
请不要 Javascript 回答,我还不知道如何使用 Javascript,而且我一直在寻找一种方法来使 IE 成为大部分客户群的工作方式还在用
提前致谢!
HTML:
<div class="flip-card-wrapper">
<div class="flip-card-container">
<div class="flip-card">
<div class="flip-card-front">Gender</div>
<div class="flip-card-back">Text</div>
</div>
</div>
<div class="flip-card-container">
<div class="flip-card">
<div class="flip-card-front">Families Network</div>
<div class="flip-card-back"><p>Text</p></div>
</div>
</div>
</div>
CSS:
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.flip-card-wrapper {
width: 840px;
height: 400px;
}
.flip-card-container {
width: 50%;
height: 100%;
perspective:1000px;
float: left;
}
.flip-card-container:hover .flip-card {
transform:rotateY(180deg);
}
.flip-card {
position: relative;
width: 100%;
height: 100%;
transform-style: preserve-3d;
transition: transform 1s;
float: left;
}
.flip-card-front, .flip-card-back {
position: absolute;
width: 100%;
height: 100%;
backface-visibility: hidden;
}
.flip-card-front {
background-color:#333;
color:#fff
}
.flip-card-back {
background-color:#517fa4;
color:#fff;
transform:rotateY(180deg);
}
建议您参考下面的例子,可以帮助您实现IE 11浏览器的翻页效果,在最新的浏览器上也能正常工作。
/* entire container, keeps perspective */
.flip-container {
perspective: 1000;
transform-style: preserve-3d;
}
/* UPDATED! flip the pane when hovered */
.flip-container:hover .back {
transform: rotateY(0deg);
}
.flip-container:hover .front {
transform: rotateY(180deg);
}
.flip-container, .front, .back {
width: 320px;
height: 480px;
}
/* flip speed goes here */
.flipper {
transition: 0.6s;
transform-style: preserve-3d;
position: relative;
}
/* hide back of pane during swap */
.front, .back {
backface-visibility: hidden;
transition: 0.6s;
transform-style: preserve-3d;
position: absolute;
top: 0;
left: 0;
}
/* UPDATED! front pane, placed above back */
.front {
z-index: 2;
transform: rotateY(0deg);
background: lightgreen;
}
/* back, initially hidden pane */
.back {
transform: rotateY(-180deg);
background: lightblue;
}
/*
Some vertical flip updates
*/
.vertical.flip-container {
position: relative;
}
.vertical .back {
transform: rotateX(180deg);
}
.vertical.flip-container:hover .back {
transform: rotateX(0deg);
}
.vertical.flip-container:hover .front {
transform: rotateX(180deg);
}
<div class="flip-container">
<div class="flipper">
<div class="front">
front
</div>
<div class="back">
back
</div>
</div>
</div>
在 IE 11 浏览器中的输出:
参考:
另外,您可以根据自己的需求尝试修改示例。
之前没有尝试过制作翻页卡片,但对 CSS 非常陌生,所以我正在努力修改网上找到的代码以满足我的需要,然后让它在 IE 上运行,有人可以指点我吗方向正确吗?
请不要 Javascript 回答,我还不知道如何使用 Javascript,而且我一直在寻找一种方法来使 IE 成为大部分客户群的工作方式还在用
提前致谢!
HTML:
<div class="flip-card-wrapper">
<div class="flip-card-container">
<div class="flip-card">
<div class="flip-card-front">Gender</div>
<div class="flip-card-back">Text</div>
</div>
</div>
<div class="flip-card-container">
<div class="flip-card">
<div class="flip-card-front">Families Network</div>
<div class="flip-card-back"><p>Text</p></div>
</div>
</div>
</div>
CSS:
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.flip-card-wrapper {
width: 840px;
height: 400px;
}
.flip-card-container {
width: 50%;
height: 100%;
perspective:1000px;
float: left;
}
.flip-card-container:hover .flip-card {
transform:rotateY(180deg);
}
.flip-card {
position: relative;
width: 100%;
height: 100%;
transform-style: preserve-3d;
transition: transform 1s;
float: left;
}
.flip-card-front, .flip-card-back {
position: absolute;
width: 100%;
height: 100%;
backface-visibility: hidden;
}
.flip-card-front {
background-color:#333;
color:#fff
}
.flip-card-back {
background-color:#517fa4;
color:#fff;
transform:rotateY(180deg);
}
建议您参考下面的例子,可以帮助您实现IE 11浏览器的翻页效果,在最新的浏览器上也能正常工作。
/* entire container, keeps perspective */
.flip-container {
perspective: 1000;
transform-style: preserve-3d;
}
/* UPDATED! flip the pane when hovered */
.flip-container:hover .back {
transform: rotateY(0deg);
}
.flip-container:hover .front {
transform: rotateY(180deg);
}
.flip-container, .front, .back {
width: 320px;
height: 480px;
}
/* flip speed goes here */
.flipper {
transition: 0.6s;
transform-style: preserve-3d;
position: relative;
}
/* hide back of pane during swap */
.front, .back {
backface-visibility: hidden;
transition: 0.6s;
transform-style: preserve-3d;
position: absolute;
top: 0;
left: 0;
}
/* UPDATED! front pane, placed above back */
.front {
z-index: 2;
transform: rotateY(0deg);
background: lightgreen;
}
/* back, initially hidden pane */
.back {
transform: rotateY(-180deg);
background: lightblue;
}
/*
Some vertical flip updates
*/
.vertical.flip-container {
position: relative;
}
.vertical .back {
transform: rotateX(180deg);
}
.vertical.flip-container:hover .back {
transform: rotateX(0deg);
}
.vertical.flip-container:hover .front {
transform: rotateX(180deg);
}
<div class="flip-container">
<div class="flipper">
<div class="front">
front
</div>
<div class="back">
back
</div>
</div>
</div>
在 IE 11 浏览器中的输出:
参考:
另外,您可以根据自己的需求尝试修改示例。