【发布时间】:2016-04-15 13:58:04
【问题描述】:
我正在尝试创建一个翻转卡 Metro 风格菜单,但是当我尝试声明正面和背面风格时,当您将鼠标悬停在正面 div 上时,它显示背面 div 时看起来不太好。
这是 CSS 代码:
ul{
-webkit-perspective: 1000;
width: 50%;
margin: 120px auto;
}
li{
width: 200px;
height: 200px;
margin-right: 10px;
margin-bottom: 10px;
float: left;
list-style: none;
position: relative;
cursor: pointer;
font-family: 'Open Sans';
font-weight: 300;
background: #34495e;
}
div{
color: yellow;
width: 100%;
height: 100%;
position: absolute;
-webkit-transition: all 0.5s ease;
-webkit-backface-visibility: hidden;
}
.front{
z-index: 3;
color: #fff;
text-align: center;
line-height: 210px;
font-size: 20px;
background: #e3e3e3;
}
.front:hover {
z-index: 0;
-webkit-transform: rotateY(180deg);
}
.back:hover {
-webkit-transform: rotateY(0deg);
}
.back{
color: #fff;
text-align: center;
line-height: 200px;
font-size: 22px;
}
#box1{ background: #1abc9c;}
#box2{ background: #2ecc71;}
#box3{ background: #3498db;}
#box4{ background: #f1c40f;}
#box5{ background: #e67e22;}
#box6{ background: #e74c3c;}
我只是想知道我们是否可以进行修复以使其背面看起来像是卡片的一部分,因为现在看起来它是一张静态的脸并且不会移动,而我只是在翻转前面一个显示另一个静态。
查看 JSFiddle:http://jsfiddle.net/p6NQ2/2/
【问题讨论】:
-
你在寻找类似this的东西吗?