简体   繁体   English

如何在循环中淡入和淡出文本

[英]How to fade in and fade out text in loop

I want the text to fade in and fade out in the loop never stop it.我希望文本在循环中淡入淡出永远不要停止它。 like, come fade in then out again and again with HTML CSS.就像,用 HTML CSS 一次又一次地淡入然后淡出。 I'm going to share with you my code which just does fade in not do fade out and loop also not so anybody sees my code and told me how I can do that with HTML OR CSS because I want to use this animated type text on WordPress website with one build on the Elementor page builder.我将与您分享我的代码,它只是淡入不淡出和循环,所以任何人都不会看到我的代码并告诉我如何使用 HTML 或 CSS 来做到这一点,因为我想在WordPress 网站,在 Elementor 页面构建器上有一个构建。 so please help.所以请帮忙。 Thank You谢谢你

 .fade-in { animation: fadeIn ease 10s; -webkit-animation: fadeIn ease 10s; -moz-animation: fadeIn ease 10s; -o-animation: fadeIn ease 10s; -ms-animation: fadeIn ease 10s; } @keyframes fadeIn { 0% { opacity: 0; } 100% { opacity: 1; } } @-moz-keyframes fadeIn { 0% { opacity: 0; } 100% { opacity: 1; } } @-webkit-keyframes fadeIn { 0% { opacity: 0; } 100% { opacity: 1; } } @-o-keyframes fadeIn { 0% { opacity: 0; } 100% { opacity: 1; } } @-ms-keyframes fadeIn { 0% { opacity: 0; } 100% { opacity: 1; }
 <h1 class="fade-in">Its just fade in not out i want fade in and out in loop never stop it.</h1>

Use animation-direction and animation-iteration properties.使用animation-directionanimation-iteration属性。

Combined into a shorthand, you get a property like: animation: fadeIn infinite alternate ease 2s组合成一个简写,你会得到一个像这样的属性: animation: fadeIn infinite alternate ease 2s

Change duration as necessary根据需要更改持续时间

 .fade-in { animation: fadeIn infinite alternate ease 2s; } @keyframes fadeIn { 0% { opacity: 0; } 100% { opacity: 1; } }
 <h1 class="fade-in">Its just fade in not out i want fade in and out in loop never stop it.</h1>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM