我正在建设使用Squaspace的网站,并添加自定义的CSS来复制文本更改动画的设计,每3秒更改一次文本.文本内容被分成两行,并进行zoom 以适应文本框.
我有代码块,我在其中添加了html标题h2.
<h2 style="text-align:center; font-size:48px" class="animated-text">
<span style="display:block;"></span>
</h2>
自定义css
.animated-text {
h2 {
display: inline-block !important;
}
span::before {
content: "Every body is different, and every workout is unique";
animation: animate infinite 5s;
}
@keyframes animate {
0% {
content: "Every body is different, and every workout is unique";
}
50% {
content: "Evidence-based, and fitness trainer reviewed Affordable, accessible, intentional"
}
}
}
附件是我正在try 实现的设计的屏幕截图
然而,我的实际结果并不准确,因为我试图使文本换行以适应文本块.是否可以在SPAN动画内容的文本内容中添加换行符,或者复制设计的最佳方式是什么?
谢谢!