gpt4 book ai didi

jquery - Firefox 的 CSS3 问题

转载 作者:行者123 更新时间:2023-11-28 12:37:25 27 4
gpt4 key购买 nike

我是 CSS3 的新手,正在努力学习。我用 css 制作了简单的页面,但它在 chrome 中正确呈现,但在 firefox 中呈现不好。我的代码如下。请帮助我。

看起来css中的人脸类有问题HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="css/css3flip.css" />
</head>
<body>


<section id="game">
<div id="cards">
<div id="card">
<div class="face front"></div>
<div class="face back cardAK"></div>
</div> <!-- .card -->
<div id="card">
<div class="face front"></div>
<div class="face back cardAQ"></div>
</div> <!-- .card -->
</div> <!-- #cards -->
</section> <!-- #game -->

<footer>
<p>This is an example of flipping cards with CSS3.</p>
<p>Click on the card to flip.</p>
</footer>

<script src="js/jquery-1.10.2.min.js"></script>
<script>

$(function(){
$("#cards").children().each(function(index){
// listen the click event of each card DIV element.
$(this).click(function(){
// add the class "card-flipped"
// the browser animate the styles between current state and card-flipped state.
$(this).toggleClass("card-flipped");
});
});
});
</script>
</body>
</html>

CSS

#game {
background: #9c9;
padding: 5px;
}

#card {
-webkit-perspective: 600;
width: 80px;
height: 120px;
margin: 8px;
}

.face {
border-radius: 10px;
width: 100%;
height: 100%;
position: absolute;
-webkit-transition: all .3s;
-webkit-backface-visibility: hidden;
}

.front {
background: #966;
z-index: 10;
}

.back {
background: #eaa;
-webkit-transform: rotate3d(0,1,0,-180deg);
z-index: 8;
}

.card-flipped .front {
-webkit-transform: rotate3d(0,1,0,180deg);
z-index: 8;
}

.card-flipped .back {
-webkit-transform: rotate3d(0,1,0,0deg);
z-index: 10;
}

.cardAK {
background: url(../images/AK.png) no-repeat;
}

.cardAQ {
background: url(../images/AQ.png) no-repeat;
}

图片

enter image description here

enter image description here

最佳答案

http://jsfiddle.net/SANBA/1/

你为 fire fox 定义的 css 也像你为 chrome 所做的那样 -webkit- 是为 chrome 而为 firefox 是 -moz-

也为 firefox 添加类似的行例如

-webkit-transform: rotate3d(0,1,0,-180deg);for chrome
-moz-transform: rotate3d(0,1,0,-180deg); for fire fox

我已经更新了你的CSS,请使用这个

 #game {
background: #9c9;
padding: 5px;
}
#card {

width: 80px;
height: 120px;
position:relative;
margin: 8px;
}
.face {
border-radius: 10px;
width: 100%;
height: 100%;
position: absolute;
-webkit-transition: all .3s;
-webkit-backface-visibility: hidden;
-moz-transition: all .3s;
-moz-backface-visibility: hidden;
transition: all .3s;
backface-visibility: hidden;
}
.front {
background: #966;
z-index: 10;
}
.back {
background: #eaa;
-webkit-transform: rotate3d(0, 1, 0, -180deg);
-moz-transform: rotate3d(0, 1, 0, -180deg);
transform: rotate3d(0, 1, 0, -180deg);
z-index: 8;
}
.card-flipped .front {
-webkit-transform: rotate3d(0, 1, 0, 180deg);
-moz-transform: rotate3d(0, 1, 0, 180deg);
transform: rotate3d(0, 1, 0, 180deg);
z-index: 8;
}
.card-flipped .back {
-webkit-transform: rotate3d(0, 1, 0, 0deg);
-moz-transform: rotate3d(0, 1, 0, 0deg);
transform: rotate3d(0, 1, 0, 0deg);
z-index: 10;
}
.cardAK {
background: url(../images/AK.png) no-repeat;
}
.cardAQ {
background: url(../images/AQ.png) no-repeat;
}

关于jquery - Firefox 的 CSS3 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17895254/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com