Safari WebKit CSS Bugs and Workarounds: A Practical Guide
Problem
When I build websites, Safari CSS issues drive me crazy. My beautiful CSS works perfectly in Chrome and Firefox, but breaks on Safari.
I recently worked on a project with backdrop-filter, CSS animations, and CSS custom properties. Everything looked great in Chrome. Then I tested on Safari.
The backdrop didn’t blur. Animations stuttered. Custom properties didn’t work as expected.
Environment
- Safari 17+ (macOS)
- Safari iOS 17+
- Testing on actual iOS devices
What Happened
I had a modal with a frosted glass effect:
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(10px);}In Chrome, this worked beautifully. In Safari, the blur didn’t appear.
Then I had CSS animations on SVGs:
.spinner { animation: rotate 2s linear infinite;}
@keyframes rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); }}In Safari, the animation was choppy.
And CSS custom properties in complex calculations:
:root { --spacing: 1rem;}
.element { width: calc(var(--spacing) * 2);}Sometimes this worked, sometimes it didn’t, depending on Safari version.
How to Solve It
Solution #1: Use WebKit Prefixes
Safari requires -webkit- prefixes for some features:
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);}I added -webkit-backdrop-filter and it worked. The blur appeared in Safari.
Solution #2: Progressive Enhancement with @supports
But wait—older Safari versions don’t support backdrop-filter at all. I need a fallback:
.modal-overlay { /* Solid fallback for older browsers */ background: rgba(0, 0, 0, 0.85);}
/* Enhanced version for supporting browsers */@supports (backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px)) { .modal-overlay { background: rgba(0, 0, 0, 0.5); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }}Now users with older Safari see a solid overlay, while users with newer Safari get the blur effect.
Solution #3: Fix SVG Animations with Hardware Acceleration
For choppy SVG animations, I force hardware acceleration:
.spinner { animation: rotate 2s linear infinite; /* Force hardware acceleration in Safari */ transform: translateZ(0); will-change: transform;}The translateZ(0) and will-change properties tell Safari to use the GPU for rendering.
Solution #4: Safer CSS Custom Properties
For CSS custom properties in calculations, I simplify:
:root { --spacing: 1rem; --double-spacing: 2rem; /* Pre-calculated */}
.element { /* Instead of calc(var(--spacing) * 2) */ width: var(--double-spacing);}I pre-calculate values instead of doing math in the browser. This works more reliably across Safari versions.
The Reason
Why does Safari have these issues?
Slower Feature Adoption
Safari adopts new CSS features more conservatively than Chrome. This means:
- Newer features may need
-webkit-prefixes - Some features appear in Chrome first, then Safari later
iOS Safari is Tied to iOS Updates
Unlike Chrome, which updates independently, Safari on iOS updates with the operating system. Users who don’t update iOS are stuck with older Safari versions.
WebKit Rendering Engine
Safari uses WebKit, which has different rendering behaviors than Chromium. Some CSS features work differently or have bugs specific to WebKit.
Common Safari CSS Issues
Here’s a quick reference of issues I’ve encountered:
| Issue | Symptom | Fix |
|---|---|---|
| backdrop-filter | No blur effect | Add -webkit- prefix |
| SVG animations | Choppy/stuttering | Add transform: translateZ(0) |
| CSS custom properties | Complex calc fails | Pre-calculate values |
| Position sticky | Doesn’t work | Check parent overflow |
| Smooth scrolling | Ignored | Add -webkit-overflow-scrolling: touch |
A Positive Note
One thing Safari does better: CSS blur effects. When I use backdrop-filter: blur(), Safari handles it smoothly. Chrome can get laggy with heavy blur effects.
So Safari isn’t all bad—it just requires different approaches.
Summary
In this post, I showed common Safari CSS issues and their workarounds. The key points are:
- Use
-webkit-prefixes for newer CSS features - Implement progressive enhancement with
@supports - Force hardware acceleration for smooth animations
- Simplify CSS custom property calculations
Safari CSS issues are manageable with feature detection and fallbacks. Unlike the IE6 era, I can detect what’s missing and provide alternatives.
Final Words + More Resources
My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me
Here are also the most important links from this article along with some further resources that will help you in this scope:
- 👨💻 caniuse.com - Safari CSS Support
- 👨💻 WebKit CSS Documentation
- 👨💻 MDN: CSS @supports
- 👨💻 Jen Simmons on Safari CSS
Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!
Comments