我用CSS做了心脏。我只是在寻找一种让它跳动/跳动的方法。用心做脉搏
下面是代码(fiddle):
#heart {
position: relative;
width: 100px;
height: 90px;
}
#heart:before,
#heart:after {
position: absolute;
-webkit-animation: heart 1s linear infinite;
content: "";
left: 50px;
top: 0;
width: 50px;
height: 80px;
background: red;
-moz-border-radius: 50px 50px 0 0;
border-radius: 50px 50px 0 0;
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
-webkit-transform-origin: 0 100%;
transform-origin: 0 100%;
}
#heart:after {
left: 0;
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
-webkit-transform-origin: 100% 100%;
transform-origin: 100% 100%;
}
<div id="heart"></div>
你的心在Firefox上坏了。你在'#heart:after'忘记了'transform-origin:100%100%'。 – Oriol 2015-02-23 17:33:25
http://lea.verou.me/2012/12/animations-with-one-keyframe/ – Zaqx 2015-02-23 17:33:34
@Oriol哎呀,使它只使用-webkit,对不起会更新我的问题 – 2015-02-23 17:33:51