gpt4 book ai didi

CSS 动画在 Firefox 中不流畅

转载 作者:行者123 更新时间:2023-11-28 14:27:47 25 4
gpt4 key购买 nike

我有这个简单的加载指示器

https://jsfiddle.net/tcdLj0f9/

body {
background: #1e263e;
}

.load {
display: flex;
position: fixed;
align-items: center;
justify-content: center;
height: 100%;
width: 100%;
}

.loadersp {
border: 12px solid #f3f3f3;
border-top: 12px solid #555!important;
border-radius: 50%;
width: 96px;
height:96px;
animation: sp-rotate 2s linear infinite;
}
@keyframes sp-rotate {
0% {
transform: rotate(0deg)
}
to {
transform: rotate(1turn)
}
}
<div class="load">
<div class="loadersp"></div>
</div>

它在 Chrome 中运行流畅,而在 Firefox 中运行不流畅(使用最新版本).. 即使查看微调器的边缘,您也可以看到它们很粗糙,这是为什么呢?我知道他们使用不同的渲染引擎,但我没想到会发生这样的事情。

那么有什么办法可以解决吗?

最佳答案

这看起来像是 Firefox 的一个错误。

如果您在 iframe 内的 position:fixed 容器中使用动画(如 jsfiddle 或 SO 代码段),它在 Firefox 中运行时不稳定。在 iframe 之外,它运行顺利。

删除 position:fixediframe 中修复它:

body {
background: #1e263e;
}

.load {
display: flex;
/* position: fixed; */
align-items: center;
justify-content: center;
height: 100%;
width: 100%;
}

.loadersp {
border: 12px solid #f3f3f3;
border-top: 12px solid #555 !important;
border-radius: 50%;
width: 96px;
height: 96px;
animation: sp-rotate 2s linear infinite;
}

@keyframes sp-rotate {
0% {
transform: rotate(0deg)
}
to {
transform: rotate(1turn)
}
}
<div class="load">
<div class="loadersp"></div>
</div>

关于CSS 动画在 Firefox 中不流畅,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54486441/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com