sodcalculator

10 Tech How-To

Find Cross Browser Compatibility Issues in HTML & CSS

Guide 10-30643 · Updated · Step by step

This guide walks you through a practical, step-by-step process for finding and fixing cross-browser compatibility issues in your HTML and CSS. You’ll learn how to systematically test your site in multiple browsers, identify the most common culprits (like flexbox gaps, CSS grid quirks, and unsupported properties), and use tools like Can I Use and browser dev tools to pinpoint problems before your users do.

What You’ll Need

  • A code editor (VS Code, Sublime Text, or any editor you prefer)
  • At least two different browsers installed (Chrome, Firefox, Safari, Edge, or Opera)
  • Optional: a free account at a cross-browser testing service like BrowserStack or Sauce Labs (useful for testing older browsers or mobile devices)
  • Optional: a virtual machine or old device if you need to test legacy browsers like IE11

Step-by-Step

  1. List your target browsers. Check your site’s analytics (Google Analytics, Plausible, etc.) to see which browsers and versions your visitors actually use. If you don’t have analytics, start with the last two versions of Chrome, Firefox, Safari, and Edge. Note any older browsers you must support (e.g., Safari 14, Edge 18).
  2. Open your site in each browser. Start with your primary browser (usually Chrome) and do a quick visual pass. Then open the same page in Firefox, Safari, and Edge. Look for obvious layout breaks: elements overlapping, missing images, misaligned grids, or unstyled content.
  3. Use the browser’s built-in responsive mode. In Chrome DevTools (F12), click the device toolbar icon (or press Ctrl+Shift+M / Cmd+Shift+M) to simulate different screen sizes. Do this in each browser to catch width-related issues.
  4. Check the console for errors. In each browser, open the developer tools (F12 or right-click → Inspect) and go to the Console tab. Look for red errors or yellow warnings. A JavaScript error can break CSS loading or interactive elements, causing inconsistencies.
  5. Inspect CSS properties with the computed styles panel. Right-click an element that looks wrong and choose “Inspect”. Go to the “Computed” or “Styles” tab. Look for properties that are crossed out or show as “invalid” — this means the browser didn’t understand the CSS. For example, if you see gap crossed out in an older browser, that’s your culprit.
  6. Use Can I Use (caniuse.com) to check property support. For any CSS property or HTML element you’re unsure about, search it on Can I Use. It shows a compatibility table for all major browsers. Pay attention to the “Partial support” and “Known issues” notes.
  7. Test with a cross-browser testing tool. If you don’t have access to all browsers locally, use a service like BrowserStack or LambdaTest. They let you run your site in real browsers on real devices (or virtual machines) and take screenshots. Run a test on your target browsers, especially older ones.
  8. Check for vendor prefixes. Some older browsers require prefixes like -webkit-, -moz-, or -ms- for certain properties (e.g., transition, transform, flex). Use a tool like Autoprefixer (a PostCSS plugin) or manually add prefixes where needed. Modern browsers don’t need them, but older ones do.
  9. Validate your HTML and CSS. Use the W3C Markup Validation Service (validator.w3.org) and the W3C CSS Validation Service (jigsaw.w3.org/css-validator). These catch syntax errors that can cause inconsistent rendering.
  10. Test with a CSS reset or normalize.css. Browsers have default margins, paddings, and font sizes that differ. Include a CSS reset (like Eric Meyer’s reset) or Normalize.css at the top of your stylesheet to level the playing field. This prevents many cross-browser differences.
  11. Check for CSS features that are known trouble spots. Pay extra attention to: flexbox (especially gap in flex containers), grid (older Safari has bugs), position: sticky, object-fit, aspect-ratio, backdrop-filter, scroll-behavior, and CSS variables (custom properties) — they work in all modern browsers but not in IE11.
  12. Test with JavaScript disabled. Some browsers or extensions block JavaScript. Temporarily disable JS in each browser (via DevTools settings) to see if your layout still holds. If it breaks, you may need to add fallback styles.
  13. Keep a checklist and fix issues iteratively. As you find issues, write them down. Fix one issue at a time, then retest in all browsers. Common fixes include adding fallback values (e.g., display: block; display: flex;), using @supports to conditionally apply styles, or replacing a property with an alternative.

Common Mistakes

  • Only testing in Chrome. Chrome is the most popular, but it’s not the only browser. Safari and Firefox have their own quirks.
  • Ignoring the console. A JavaScript error can prevent CSS from loading or cause layout shifts. Always check the console first.
  • Assuming all modern browsers are the same. Safari still has bugs with flexbox gap (fixed in Safari 14.1+) and aspect-ratio (fixed in Safari 15). Even within modern versions, there are differences.
  • Not using a CSS reset. Without a reset, default margins and padding differ across browsers, causing inconsistent spacing.
  • Overusing vendor prefixes. Adding -webkit- to everything is unnecessary and can cause conflicts. Only add prefixes where needed (check Can I Use).
  • Not testing on real devices. Emulators are helpful, but they don’t replicate all mobile browser quirks. Test on an actual iPhone and Android phone if possible.

Tips

  • Use a feature detection library. Modernizr (though deprecated) or a simple @supports rule can help you apply fallback styles only when needed.
  • Start with a solid base. Use a CSS framework like Bootstrap or Tailwind that already handles cross-browser issues. But still test, because frameworks don’t cover everything.
  • Use the browser’s built-in screenshot tools. Chrome and Firefox have a “Capture full size screenshot” option in DevTools. Take screenshots of each page in each browser and compare side-by-side.
  • Keep your CSS simple. The more complex your CSS, the more likely you’ll hit a browser bug. Use the simplest technique that works.
  • Use CSS variables for fallback. Define a fallback value before the variable, like color: red; color: var(--brand-color); — if the variable isn’t supported, the fallback applies.
  • Automate with a tool. Consider using a tool like Playwright or Puppeteer to run automated cross-browser tests. It’s a bigger setup but saves time in the long run.

Troubleshooting

If you’ve followed the steps but still have issues, try these:

  • Clear your browser cache. Sometimes you’re seeing a cached version of your CSS. Hard refresh with Ctrl+F5 (Windows) or Cmd+Shift+R (Mac).
  • Check for browser extensions. Extensions like ad-blockers or dark-mode toggles can alter your page. Test in incognito/private mode with extensions disabled.
  • Use the “Toggle device toolbar” to test at exact viewport widths. Some issues only appear at specific widths (e.g., 768px). Use the device toolbar to set exact pixel widths.
  • Look for CSS that’s being overridden. In DevTools, check the “Styles” tab for strikethrough properties. That means another rule is overriding it. Use the “Inherited from” section to see which rule wins.
  • If a property doesn’t work in Safari, try adding a fallback. For example, if gap in flexbox doesn’t work, use margins on children instead.
  • If nothing works, simplify. Temporarily remove sections of CSS to isolate the problem. Once you find the culprit, you can replace it with a more compatible approach.

Frequently Asked Questions

What is the most common cross-browser CSS issue?

Flexbox gap is a common one — it’s not supported in Safari before 14.1 and some older browsers. Also, CSS Grid has had bugs in older Safari versions.

Do I really need to support Internet Explorer?

Only if your analytics show IE usage. If you don’t have data, it’s safe to drop IE11 support as of 2023, since Microsoft ended support for it. But if your audience is in a corporate environment, you might still need it.

How do I test on Safari if I have a Windows PC?

You can’t install Safari on Windows anymore (older versions exist but are outdated). Use a cloud testing service like BrowserStack or a Mac virtual machine (if you have a Mac). Alternatively, use an online tool like LambdaTest that offers Safari on real devices.

What is the difference between a CSS reset and Normalize.css?

A CSS reset removes ALL default browser styling (margins, paddings, font sizes). Normalize.css keeps useful defaults but makes them consistent across browsers. Normalize is generally recommended because it preserves semantic elements.

Can I use CSS variables in all browsers?

CSS variables (custom properties) are supported in all modern browsers (Chrome 49+, Firefox 31+, Safari 9.1+, Edge 15+). They don’t work in IE11. If you need IE11 support, use a preprocessor like Sass with variables that compile to static values.

How often should I test for cross-browser issues?

At minimum, test whenever you make significant layout changes. Ideally, set up a routine — e.g., test after every major feature or before a release. Automated testing can help you do this more frequently.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →