Webflow sync, pageviews & more.
NEW

How can I make CSS media query gaps work on an older iPhone 5 with iOS 10.3.4 and Safari for my Ecommerce site using Webflow?

TL;DR
  • Avoid using Flexbox gap on older Safari; use manual margins for spacing instead.
  • If feasible, rebuild layout with CSS Grid for better gap support and test on real/simulated devices.

CSS media query-based gap properties may not work on older Safari versions like the one on iPhone 5 (iOS 10.3.4), as support for gap in flexbox layouts was only added in Safari 14+.

1. Understand the Gap Compatibility Issue

  • The gap property in flexbox (commonly used in Webflow layouts) isn't supported in Safari versions prior to v14, which includes Safari 10 on iPhone 5.
  • That means gap, row-gap, and column-gap won’t apply to flex containers on these devices.
  • gap does work in grid layouts, even back in Safari 13, but not earlier.

2. Confirm How Your Layout is Built in Webflow

  • Check if your layout uses Flexbox: In Webflow Designer, select relevant containers (e.g., product grids or sections) and look at the Layout section in the right panel.
  • If it says Flex, and you're using Gap, that’s the compatibility issue.

3. Use Margin as a Fallback for Flexbox Gaps

  • Replace gap with manual margins to support older browsers.
  • In Webflow:
  • Select the element you want to space (e.g., product cards).
  • Add right or bottom margin manually to simulate the gap.
  • Make sure the last item in the row or column doesn’t create extra space—use combo classes for that edge item if needed.

4. Switch to Grid if Possible (with Caveats)

  • If Flexbox isn’t critical for your layout, rebuild using CSS Grid, which supports gap more consistently across older browsers.
  • In Webflow:
  • Convert your Flex container to a Grid layout using Webflow's Grid features.
  • Keep in mind iPhone 5 may still have rendering issues with complex grid layouts, so test thoroughly.

5. Use Media Queries + Feature Detection Only When Necessary

  • You can’t polyfill gap in Flexbox, so feature detection won’t help here.
  • If you do need to hide or change layout for older devices, apply media queries based on screen size (e.g., max-width: 320px) directly in Webflow’s Designer using custom breakpoints or via custom code in Page Settings.

6. Test Your Site on iPhone 5

  • Use real device testing or simulators like BrowserStack to preview the layout and confirm your fallback solution is working.

Summary

To make gap spacing work on iPhone 5 with iOS 10.3.4, don't use Flexbox gaps. Instead, manually apply margins for spacing or switch to a CSS Grid layout if the design allows. Be sure to test with real or simulated conditions to ensure full compatibility.

Rate this answer

Other Webflow Questions