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
  • Check for known Safari CSS Grid issues and ensure vendor prefixes are included for compatibility.
  • Use Safari's Responsive Design Mode to verify layout integrity across devices.
  • Implement specific CSS fixes and test with simplified grid properties to address display discrepancies.

CSS Grid behaviors may differ between browsers, causing elements to display incorrectly in Safari. This can impact both Safari on desktop and iPad. Here's how to address these issues.

1. Check for Known Safari CSS Grid Issues

  • Safari, particularly before version 14, has known bugs and limited support for certain aspects of CSS Grid.
  • Autoplacement issues and quirky behavior with auto-fit and auto-fill are common culprits.

2. Ensure Vendor Prefixes Are Included

  • For legacy support, include the -webkit- prefix for grid-related properties like display: -webkit-grid.
  • While Webflow generally handles prefixes, a custom solution might require additional support.

3. Verify Layout Integrity with a Responsive Design Mode

  • Check your grid layout in Safari's developer tools to spot discrepancies.
  • Use Responsive Design Mode to preview the layout on different screen sizes, including iPads.

4. Implement Specific CSS Fixes

  • Manually adjust grid areas if certain elements do not align as expected in Safari.
  • For stretching issues, set explicit widths/heights rather than relying on auto or other fluid sizes.

5. Test with Simplified Grid Properties

  • Simplify complex properties like grid-template-areas to determine if specific syntax is causing issues.
  • Ensure line-based properties (grid-row/grid-column) are used in a consistent manner.

Summary

CSS Grid issues in Safari can often be resolved by checking for known bugs, including vendor prefixes, and testing your layout thoroughly. Simplifying your grid configuration and explicitly defining sizes can also mitigate display discrepancies.

Rate this answer

Other Webflow Questions