<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/fixing-fluid-typography-o7y0d8tnl" -->

---
title: Fixing fluid typography | daily.dev
description: A walkthrough of fixing two common problems with fluid typography on the web. First, using viewport-based clamp() causes font sizes to keep growing past a...
canonical: https://daily.dev/posts/fixing-fluid-typography-o7y0d8tnl
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Fixing fluid typography | daily.dev
og:description: A walkthrough of fixing two common problems with fluid typography on the web. First, using viewport-based clamp() causes font sizes to keep growing past a...
og:url: https://daily.dev/posts/fixing-fluid-typography-o7y0d8tnl
og:image: https://api.daily.dev/og/posts/O7y0d8tNl.png
og:image:alt: Fixing fluid typography
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Fixing fluid typography

**[Kevin Powell](https://daily.dev/sources/kevinpowell)** · 9 min read · 8 upvotes · 0 comments

## Summary

A walkthrough of fixing two common problems with fluid typography on the web. First, using viewport-based clamp() causes font sizes to keep growing past a layout's max width, which is solved by switching to container query units (cqi) after explicitly declaring a container. Second, applying container queries on nested containers (like cards inside a wrapper) leads to inconsistent font sizes across elements using the same declaration, which is fixed by registering a custom property with @property (giving it a syntax, initial value, and inherits setting) so the computed length value is saved and stays consistent across children, rather than being recalculated per container. The technique credits an idea originally described by Ana Tudor in a blog post for a different use case.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=q-_cIlttYBc>

## Questions this post answers

### Why does my fluid typography using clamp() with viewport units keep growing even after the layout hits its max width?

Clamp() based on viewport width (vi) units only looks at the viewport size, not the actual space available in a constrained layout, so once the layout hits its max width the font continues scaling with the viewport instead of stopping. The fix is to switch to container query inline (cqi) units and explicitly declare the wrapper element as a container, so the font size is based on the container's size instead.

_Anyone chasing this fluid typography quirk can find deeper CSS breakdowns curated on daily.dev._

### Why do container query units produce inconsistent font sizes across nested elements with the same CSS declaration?

When multiple nested elements (like cards inside a wrapper) are each declared as their own container, each one calculates the container query unit relative to its own size rather than a shared reference, causing the same font-size declaration to compute to different values. Registering a custom property with @property and computing the value once against the wrapper container fixes the inconsistency by saving a fixed computed length that all children inherit.

_Developers debugging inconsistent container-based typography can track these CSS techniques on daily.dev._

### How do I use @property in CSS to save a computed container query length so it stays consistent across elements?

Register the custom property with @property, specifying syntax as length, an initial-value like 1rem, and inherits set to true. Redeclare the property (e.g., step-two) using the container query unit expression on the wrapper's direct children; because it is registered, the browser computes and stores the resulting length as a fixed number rather than re-evaluating the expression per element, so all children inherit the same consistent value.

_Those setting up consistent fluid type scales can keep up with CSS custom property tricks via daily.dev._

## Similar posts on daily.dev

- [Building a UI Without Breakpoints – Frontend Masters Blog](https://daily.dev/posts/building-a-ui-without-breakpoints-frontend-masters-blog-gttwzftuz) · Frontend Masters · 9 upvotes · 0 comments
- [Responsive and Fluid Typography with Baseline CSS Features](https://daily.dev/posts/responsive-and-fluid-typography-with-baseline-css-features-rnoepawxs) · OddBird · 4 upvotes · 0 comments
- [Stop Treating CSS Container Queries Like Traditional Media Queries — Smashing Magazine](https://daily.dev/posts/stop-treating-css-container-queries-like-traditional-media-queries-smashing-magazine-opborjqov) · Smashing Magazine · 8 upvotes · 0 comments
- [Fixing full-bleed CSS](https://daily.dev/posts/fixing-full-bleed-css-jyiwcav6l) · dbushell · 29 upvotes · 3 comments
- [CSS Container Queries](https://daily.dev/posts/css-container-queries-iq9qajosu) · Flavio Copes · 24 upvotes · 0 comments

---

Tags: [#css](https://daily.dev/tags/css), [#ui-design](https://daily.dev/tags/ui-design)

[View this post on daily.dev](https://daily.dev/posts/fixing-fluid-typography-o7y0d8tnl)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Fixing fluid typography","url":"https://daily.dev/posts/fixing-fluid-typography-o7y0d8tnl","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/fixing-fluid-typography-o7y0d8tnl"},"datePublished":"2026-09-16T13:18:36.497Z","dateModified":"2026-09-16T13:19:00.958Z","description":"A walkthrough of fixing two common problems with fluid typography on the web. First, using viewport-based clamp() causes font sizes to keep growing past a...","image":"https://i.ytimg.com/vi/q-_cIlttYBc/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/q-_cIlttYBc/sddefault.jpg","isAccessibleForFree":true,"articleSection":"Kevin Powell","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Kevin Powell","logo":"https://media.daily.dev/image/upload/s--XK5Rf0kM--/f_auto/v1717745137/logos/kevinpowell","url":"https://daily.dev/sources/kevinpowell"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/fixing-fluid-typography-o7y0d8tnl","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":8},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"css,ui-design","timeRequired":"PT9M","video":{"@type":"VideoObject","name":"Fixing fluid typography","description":"A walkthrough of fixing two common problems with fluid typography on the web. First, using viewport-based clamp() causes font sizes to keep growing past a...","thumbnailUrl":"https://i.ytimg.com/vi/q-_cIlttYBc/sddefault.jpg","uploadDate":"2026-09-16T13:18:36.497Z","duration":"PT9M","url":"https://api.daily.dev/r/O7y0d8tNl","embedUrl":"https://www.youtube.com/embed/q-_cIlttYBc"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Kevin Powell","item":"https://daily.dev/sources/kevinpowell"},{"@type":"ListItem","position":3,"name":"Fixing fluid typography"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/fixing-fluid-typography-o7y0d8tnl#faq","mainEntity":[{"@type":"Question","name":"Why does my fluid typography using clamp() with viewport units keep growing even after the layout hits its max width?","acceptedAnswer":{"@type":"Answer","text":"Clamp() based on viewport width (vi) units only looks at the viewport size, not the actual space available in a constrained layout, so once the layout hits its max width the font continues scaling with the viewport instead of stopping. The fix is to switch to container query inline (cqi) units and explicitly declare the wrapper element as a container, so the font size is based on the container's size instead. Anyone chasing this fluid typography quirk can find deeper CSS breakdowns curated on daily.dev."}},{"@type":"Question","name":"Why do container query units produce inconsistent font sizes across nested elements with the same CSS declaration?","acceptedAnswer":{"@type":"Answer","text":"When multiple nested elements (like cards inside a wrapper) are each declared as their own container, each one calculates the container query unit relative to its own size rather than a shared reference, causing the same font-size declaration to compute to different values. Registering a custom property with @property and computing the value once against the wrapper container fixes the inconsistency by saving a fixed computed length that all children inherit. Developers debugging inconsistent container-based typography can track these CSS techniques on daily.dev."}},{"@type":"Question","name":"How do I use @property in CSS to save a computed container query length so it stays consistent across elements?","acceptedAnswer":{"@type":"Answer","text":"Register the custom property with @property, specifying syntax as length, an initial-value like 1rem, and inherits set to true. Redeclare the property (e.g., step-two) using the container query unit expression on the wrapper's direct children; because it is registered, the browser computes and stores the resulting length as a fixed number rather than re-evaluating the expression per element, so all children inherit the same consistent value. Those setting up consistent fluid type scales can keep up with CSS custom property tricks via daily.dev."}}]}
```

