CSS 位置:相对和 -webkit-transform 会造成文本粗细问题
当触发 CSS 动画并且使用 CSS 将对象定位为除 static
(relative
、absolute
等)以外的任何内容时,其中的文本在动画期间,对象突然变得非常薄。然后它会恢复到全宽度。
尝试在 Safari 中运行此页面: http://pastehtml.com/view/bjgaloxjj.html (已更新以供澄清)
请注意,当 #content
div 未绝对或相对定位时,问题就会消失。这是针对 iPad Web 应用程序的,在设备上比在桌面上更明显。
关于造成这种干扰的原因有什么想法吗?
编辑澄清:必须使用 webkit-transform
和 webkit-transition
因为它们是硬件加速的,这会导致更流畅的动画。
When a CSS animation is triggered and an object is positioned with CSS to be anything other than static
(relative
, absolute
, etc) the text inside the object suddenly goes very thin for the duration of the animation. It then reverts back to full width afterwards.
Try running this page in Safari: http://pastehtml.com/view/bjgaloxjj.html (updated for clarification)
Note that the problem disappears when the #content
div is not positioned absolutely or relatively. This is for an iPad web app, and is more pronounced on the device than on a desktop.
Any ideas as to what's causing this interference?
Edit for clarification: webkit-transform
and webkit-transition
must be used due to them being hardware accelerated, and this results in smoother animation.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我能够重现您的问题并解决它。您不需要
转换
来实现您正在寻找的结果,只需要转换
。transition
本身是硬件加速的。来自 http://www.html5rocks.com/en/tutorials /speed/html5/#toc-hardware-accell:
演示: http://jsfiddle.net/ThinkingStiff/bqSJX/
脚本:
CSS:
HTML:
I was able to reproduce your problem and this fixes it. You don't need a
transform
to achieve the result you're looking for, only atransition
.transition
by itself is hardware accelerated.From http://www.html5rocks.com/en/tutorials/speed/html5/#toc-hardware-accell:
Demo: http://jsfiddle.net/ThinkingStiff/bqSJX/
Script:
CSS:
HTML: