当我将鼠标悬停在卡片上时,卡片会翻转,并且在Chrome浏览器中绝对可以。但是在Microsoft Edge中,图像也是可见的并且在翻转。
.main{
width:500px;
height:500px;
border: 1px solid red;
padding:30px;
}
.first{
display:flex;
flex-direction:column;
// justify-content:center;
align-items:center;
img{
width:200px;
border-radius:50%;
margin-top: -50px;
}
}
.second{
color:blue;
}
//Need to provide override height and width of flip__card class
.flip__card {
position: relative;
&:hover &-front {
-webkit-transform: rotateY(-180deg);
transform: rotateY(-180deg);
}
&:hover &-back {
-webkit-transform: rotateY(0deg);
transform: rotateY(0deg);
}
&-front {
position: absolute;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-transition: -webkit-transform 300ms;
transition: -webkit-transform 300ms;
transition: transform 300ms;
transition: transform 300ms, -webkit-transform 300ms;
-webkit-transition-timing-function: linear;
transition-timing-function: linear;
transform: rotateY(0deg);
}
&-back {
position: absolute;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-transition: -webkit-transform 300ms;
transition: -webkit-transform 300ms;
transition: transform 300ms;
transition: transform 300ms, -webkit-transform 300ms;
-webkit-transition-timing-function: linear;
transition-timing-function: linear;
-webkit-transform: rotateY(180deg);
transform: rotateY(180deg);
}
}
<div class="main flip__card">
<div class="first flip__card-front">
<div><img src="https://static.pexels.com/photos/221471/pexels-photo-221471.jpeg" width="200px" height="200px">
</div>
<div>
Dummy text
</div>
<div>
<div class="second flip__card-back">
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Quidem voluptatem mollitia eius veniam consectetur? Necessitatibus cumque obcaecati, laboriosam minima doloremque quod odit! Quo cupiditate dolorum explicabo laborum, iste tenetur rem.
</div>
</div>
因此,将鼠标悬停在卡上时,在ME浏览器中的图像也是可见的,并且处于翻转位置。而我在卡的背面没有使用任何图像。
答案 0 :(得分:2)
在Microsoft Edge上进行了测试,并且可以正常工作。我认为您的错误是由于简单的HTML错误引起的。确保正确关闭所有div
标签,并将其放在正确的位置,我认为您不希望将.card-back
放置在.card-front
中。
.main{
width:500px;
height:500px;
border: 1px solid red;
padding:30px;
}
.first{
display:flex;
flex-direction:column;
justify-content:center;
align-items:center;
}
.first img {
width:200px;
border-radius:50%;
margin-top: -50px;
}
.second{
color:blue;
}
.flip__card {
position: relative;
}
.flip__card:hover .flip__card-front {
-webkit-transform: rotateY(-180deg);
transform: rotateY(-180deg);
}
.flip__card:hover .flip__card-back {
-webkit-transform: rotateY(0deg);
transform: rotateY(0deg);
}
.flip__card-front {
position: absolute;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-transition: -webkit-transform 300ms;
transition: -webkit-transform 300ms;
transition: transform 300ms;
-webkit-transition-timing-function: linear;
transition-timing-function: linear;
transform: rotateY(0deg);
}
.flip__card-back {
position: absolute;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-transition: -webkit-transform 300ms;
transition: -webkit-transform 300ms;
transition: transform 300ms;
transition: transform 300ms, -webkit-transform 300ms;
-webkit-transition-timing-function: linear;
transition-timing-function: linear;
-webkit-transform: rotateY(180deg);
transform: rotateY(180deg);
}
<div class="main flip__card">
<div class="first flip__card-front">
<div><img src="https://static.pexels.com/photos/221471/pexels-photo-221471.jpeg" width="200px" height="200px"></div>
<div>Dummy text</div>
</div>
<div class="second flip__card-back">
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Quidem voluptatem mollitia eius veniam consectetur? Necessitatibus cumque obcaecati, laboriosam minima doloremque quod odit! Quo cupiditate dolorum explicabo laborum, iste tenetur rem.
</div>
</div>