Webflow sync, pageviews & more.
NEW

How can I troubleshoot a custom code solution for a max-font-size property in Webflow that is not working properly on different screen sizes?

TL;DR
  • Use the CSS clamp() function to set minimum, scalable, and maximum font sizes since max-font-size isn’t a valid property.
  • Ensure custom CSS is correctly embedded, targets the right Webflow selectors, avoids browser conflicts, and works across all breakpoints.

If your custom code for max-font-size isn't working as expected across different screen sizes in Webflow, it's likely due to CSS limitations or conflicts with Webflow's own styling system.

1. Understand the Problem with max-font-size

  • CSS does not support a native max-font-size property. Only font-size is valid, and it doesn’t have a built-in max constraint.
  • If you're trying to limit font scaling in fluid typography, you'll need to use clamp() or JavaScript-based alternatives.

2. Use clamp() for Fluid Typography

  • The clamp() function allows you to define minimum, scalable, and maximum font sizes.
  • Example: font-size: clamp(1rem, 2.5vw, 2rem);
  • 1rem = minimum font size.
  • 2.5vw = scalable value based on viewport width.
  • 2rem = maximum size cap.

3. Apply Custom Code Correctly in Webflow

  • Go to Page Settings → scroll to Before or Before custom code sections.
  • Add a <style> tag if not using an Embed component inside the Designer.
  • Make sure your CSS targets the right class or selector from Webflow – inspect the published HTML using browser dev tools to verify.

4. Check for Selector Conflicts

  • Use browser developer tools to inspect the computed font-size.
  • Conflicts can arise if:
  • Webflow’s Designer controls override your custom styles.
  • Styles are not specific enough (you may need to increase specificity).
  • The custom code is loading after the Webflow styles.

5. Test Across Breakpoints

  • Webflow allows breakpoint-specific styling.
  • If you're using custom CSS for font sizing, make sure it adapts properly to each media query.
  • You can include media queries like:
  • @media screen and (max-width: 768px) { .my-heading { font-size: clamp(1rem, 4vw, 1.5rem); } }

6. Confirm Proper Embed Location

  • For site-wide styling, use the Project Settings > Custom Code tab.
  • For page-specific changes, use that page’s Page Settings custom code area.
  • For control inside a Webflow page element, use an Embed block and wrap your custom styles in <style> tags.

Summary

To fix a non-working max-font-size in Webflow, use clamp() to simulate a max size, ensure your CSS targets the correct selectors without conflicts, and test across breakpoints. CSS does not support max-font-size directly, so clamp() is your best option for fluid, responsive typography.

Rate this answer

Other Webflow Questions