【发布时间】:2020-08-14 04:29:24
【问题描述】:
我正在使用关键帧动画来改变单词轮播。它在桌面上运行良好,但动画在移动设备上根本不起作用。我已经在移动设备上尝试过 Safari 和 Chrome(另一个用户也是如此),但都没有工作。任何帮助将不胜感激!另外,我使用的跨度内容只是占位符。
.carousel {
display: inline-block;
}
.carousel h3 {
font-family: 'Space Mono', monospace;
font-size: 2.1rem;
font-weight: 400;
line-height: 1.7em;
}
.carousel h3:before{
content: 'architecture';
-webkit-animation: animate 10s linear infinite;
}
@-webkit-keyframes animate {
0%, 100%{
content: 'architecture';
}
20%{
content: 'illustration';
}
40%{
content: 'x';
}
60%{
content: 'y';
}
80%{
content: 'z';
}
}
<span class="hero-italic">My work is inspired by </span><span class="carousel"><h3></h3></span>.</h1>
【问题讨论】:
-
我以移动格式检查了您的代码。您的代码运行良好。
-
它应该适用于大多数现代移动浏览器。我建议使用
::before而不是:before,因为::代表一个伪元素,:代表一个伪类。