[英]How to define @keyframes with particular selectors in CSS
I have a widget and I am trying to put all my code inside the widget selector so it doesn't break exterior css(of the website where widget is placed). 我有一个小部件,我试图将我的所有代码放在小部件选择器中,因此它不会破坏外部css(放置小部件的网站)。 For this I also want to put my animation under the widget selector. 为此,我还想将我的动画放在小部件选择器下。
Placing a selector infront of the @keyframes breaks the code and animation doesn't work 放置@keyframes前面的选择器会破坏代码并且动画不起作用
This works: 这有效:
animation: slide-up-fade-in ease 1s;
@keyframes slide-up-fade-in{
0% {
...
}
}
But if I place a selector in front of the @keyframes it stops working 但是,如果我在@keyframes前放置一个选择器,它就会停止工作
animation: slide-up-fade-in ease 1s;
mybot @keyframes slide-up-fade-in{
0% {...}
Maybe it will help: 也许它会有所帮助:
#box {
-webkit-animation: NAME-YOUR-ANIMATION 5s infinite; /* Safari 4+ */
-moz-animation: NAME-YOUR-ANIMATION 5s infinite; /* Fx 5+ */
-o-animation: NAME-YOUR-ANIMATION 5s infinite; /* Opera 12+ */
animation: NAME-YOUR-ANIMATION 5s infinite; /* IE 10+, Fx 29+ */
}
@-webkit-keyframes NAME-YOUR-ANIMATION {
0% { opacity: 0; }
100% { opacity: 1; }
}
@-moz-keyframes NAME-YOUR-ANIMATION {
0% { opacity: 0; }
100% { opacity: 1; }
}
@-o-keyframes NAME-YOUR-ANIMATION {
0% { opacity: 0; }
100% { opacity: 1; }
}
@keyframes NAME-YOUR-ANIMATION {
0% { opacity: 0; }
100% { opacity: 1; }
}
With this CSS everything should work correctly. 有了这个CSS,一切都应该正常工作。 :) :)
@keyframes heartBeat { from { transform: scale(0.7); } 0% { transform: scale(0.55); } 25% { transform: scale(0.7); } 50% { transform: scale(0.6); } 60% { transform: scale(0.7); } 100% { transform: scale(0.55); } to { transform: scale(0.7); } } .animation-heartBeat { animation: .7s infinite heartBeat; }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.