Webflow sync, pageviews & more.
NEW

What is causing my CSS Grid elements to display incorrectly in Safari and how can I fix it for both Safari on desktop and Safari on iPad?

TL;DR
  • Define explicit rows/columns and avoid relying on auto placement or minmax with auto.
  • Replace min-content/max-content with fixed sizes or fractions, and ensure grid items have width/max-width set to 100%.
  • Test and fix Safari-specific issues using updated versions, -webkit- prefixes, or Webflow custom code.
  • Use safe, well-supported grid patterns in Webflow and verify behavior with Safari's Developer Tools.

CSS Grid layouts may display incorrectly in Safari due to inconsistent support for certain CSS properties or outdated WebKit behavior. Here’s how to diagnose and fix common Safari-specific Grid issues.

1. Check for Implicit Grid Issues

  • Safari (especially older versions) can misinterpret auto-placement in CSS Grid and create unintended rows/columns.
  • Make sure you're explicitly defining rows and columns using grid-template-rows and grid-template-columns.
  • Avoid relying solely on auto settings; instead, assign specific widths or fractions (e.g., 1fr).

2. Avoid Minmax with Auto in Grid Definitions

  • Safari struggles with minmax(0, auto) or similar flexible declarations.
  • Replace it with minmax(0, 1fr) or specify a fixed size if flexibility isn't needed.
  • Example: Change grid-template-columns: minmax(0, auto) to grid-template-columns: 1fr.

3. Verify Max-Content and Min-Content Behavior

  • Safari has known layout issues with min-content and max-content in grid tracks.
  • Replace these with fixed values or use percentages/fracs when possible.

4. Set Explicit Widths on Grid Items

  • Unintentional overflow or layout breaking can occur when child elements grow beyond their container.
  • Add max-width: 100% to images or content elements inside the grid.
  • Set grid items to have width: 100% if stretch behavior seems broken.

5. Update Safari or Use WebKit-Specific Fixes

  • Ensure you’re testing on an updated version of Safari; older versions have known Grid bugs.
  • If targeting older Safari (desktop or iPad), consider adding -webkit- prefixed styles where needed.
  • Use Webflow’s custom code section to target these fixes globally if needed (e.g., style tags in the Footer code section).

6. Use Safe Grid Properties in Webflow Designer

  • Avoid using Webflow features like grid-auto-flow in ambiguous ways without explicitly testing.
  • Stick to widely supported grid layout patterns: fixed columns, rows, and clearly assigned grid areas.

7. Test with Safari Developer Tools

  • Use Responsive Design Mode in Safari to test both iPad and desktop.
  • Inspect if items are expanding unexpectedly or stacking incorrectly due to Grid mishandling.

Summary

Safari Grid issues often stem from flexible sizing with auto or minmax settings, combined with older WebKit behavior. Define explicit sizes, avoid auto-based minmax, and ensure responsive widths on children to fix display problems across Safari on desktop and iPad.

Rate this answer

Other Webflow Questions