You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Safari 11+(含iOS)不再支持CSS calc()过渡,求变更原因

Why calc() Transitions Broke in iOS 11 Safari

Hey, great question—let’s break down exactly why your calc()-based transitions stopped working after updating to iOS 11, since you already have a reliable JS workaround in place.

First, let’s rule out your initial hypotheses:

  • It’s not a performance issue: Calc() had already been optimized in prior Safari versions, and iOS 11 didn’t deprecate this pattern for performance reasons. This was purely a rendering logic bug, not a performance-related cut.
  • It’s not a new -webkit- syntax requirement: You’re already including -webkit-calc(), but by iOS 11, Safari fully supported standard calc() without prefixes. The prefix wasn’t the problem here.

The real root cause: WebKit rendering engine compatibility bug

iOS 11 shipped with an update to the WebKit engine that changed how it handles transitions for properties using calc() values. Here’s the breakdown:
When you toggle the full-width/half-width classes via AngularJS, Safari in iOS 11 didn’t properly detect the computed value change from the calc() expressions. Instead of calculating the actual pixel width before/after the class switch (which triggers the transition), it treated the calc() string itself as the property value. Since the property changed from one calc expression to another (not a clear numeric value), the engine didn’t recognize it as a valid transition trigger.

This directly explains why fixed values (like 100% or 50%) worked—those are direct, easily comparable values that the engine can immediately detect as changing, so it fires the transition as expected.

Quick side note on future compatibility

While your JS approach (calculating the value and assigning it directly) is solid for iOS 11 support, later iOS versions (11.2 and above) fixed this WebKit bug. So if your app supports newer iOS releases, the calc() transition should work again without workarounds.

内容的提问来源于stack exchange,提问作者Gabcvit

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 08:13:13