iPad 上的 Safari 渲染 CSS 渐变或图像的效率是否更高?
我希望对我的网络应用程序中重复绘制的元素使用 CSS 渐变,因为它可以让我更灵活地动态更改其外观。然而,我的问题是浏览器渲染渐变是否比位图图像更昂贵。或者图像使用更多的处理能力? (而且我不关心跨浏览器兼容性 - 该应用程序只能在 iPad 上使用)
I'm looking to use CSS gradients for an element of my web app that is drawn repetitively, as it would allow me more flexibility in dynamically changing its appearance. However, my question is whether gradients are more expensive for the browser to render than bitmap images. Or do images use more processing power? (And I'm not concerned with cross-browser compatibility- the app will only be used on the iPad)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 Webkit Wiki 上的一篇文章,图像表现更好:
来源: https://trac.webkit.org/wiki/QtWebKitGraphics#Usestaticimages
的当然,您必须平衡 CPU 时间与从服务器加载图像所需的额外时间。此外,对于 Internet Explorer,过滤器速度非常慢,尤其是在一页上有很多过滤器的情况下。
上述答案直接来自 在 CSS 中使用背景渐变与使用图像相比,性能如何?
这些链接对您很有用
浏览器重绘/回流性能:使用 CSS3 渐变与 PNG 渐变
CSS 渐变比 SVG 背景更快
http://leaverou.me/2011/08 /css-gradients-are-much-faster-than-svg/
CSS3 与图像的运行时性能
http://jacwright.com/476/runtime-performance-with -css3-vs-images/
According to an article on the Webkit Wiki, images perform better:
Source: https://trac.webkit.org/wiki/QtWebKitGraphics#Usestaticimages
Of course, you have to balance that CPU time with the extra time it would take to load the image from the server. Also, for Internet Explorer, filters are extremely slow, especially if you have many on one page.
This above answer is directly lifted from How does the performance of using background-gradients in CSS vs using images?
These links can be useful read for you
Browser Repaint/Reflow performance: using CSS3 Gradients vs PNG Gradients
CSS gradients are faster than SVG backgrounds
http://leaverou.me/2011/08/css-gradients-are-much-faster-than-svg/
Runtime Performance with CSS3 vs Images
http://jacwright.com/476/runtime-performance-with-css3-vs-images/