• Skip to primary navigation
  • Skip to main content
  • Skip to footer
Web Design KC's Logo

Web Design KC

we build really cool websites for small businesses.

  • Home
  • Pricing
    • SEO
    • Maintenance Request
  • Portfolio
    • Case Studies
  • About
    • For Agencies
    • Locations
  • Blog
  • Contact
Home » Blog » Create Fluid Headlines with CSS clamp()

Create Fluid Headlines with CSS clamp()

October 23, 2026 by Kolten Craft Leave a Comment

CSS Lab 07 / Fluid headlines — illustrated example

A headline can grow smoothly between phone and desktop sizes without a stack of media queries. clamp() gives it a minimum, a preferred calculation, and a maximum. This example lets you see those bounds by changing the preview width as well as the CSS.

Try the CSS07 / Fluid headlines

Change the CSS below. The preview updates as you type. Your edits stay in this browser tab.

Live preview

Resize the preview using the width control, then adjust the minimum, preferred, and maximum sizes.

HTML for this example
<section class="fluid-hero"><span class="eyebrow">A fictional studio</span><h1>Make room<br>for good ideas.</h1><p>A headline that grows with its viewport while staying inside a sensible range.</p></section>

Read the three values from left to right

In clamp(2rem, 1rem + 5vw, 4.5rem), the preferred value grows with the viewport but cannot fall below 2rem or rise above 4.5rem. Combining rem and viewport units keeps a font-relative contribution in that middle value. The preview is an iframe, so its own width controls vw in this demo.

Try the headline with real copy

Increase the middle value to make the size grow more quickly. Change the maximum to see where the headline stops growing. Test a longer heading as well as your shortest one; line-height, letter spacing, and available width affect the result just as much as font size. The example uses a deliberate line break for its particular wording, not a rule for every headline.

Do not let fluid sizing replace zoom testing

A fluid formula is not automatically accessible. Check browser zoom and larger default text settings, including at 200%, and make sure the heading can wrap without clipping. Avoid fixed-height containers around important text. On a real site, preserve the page’s heading hierarchy rather than copying this demo’s h1 into every section.

Reference: MDN on clamp().

Have a client website that needs this kind of attention? See our WordPress development for agencies and case studies.

Keep exploring

CSS LabCSS FundamentalsResponsive Design
  • 10 Principles Of Good Web Design ↗
  • Create Consistent Image and Video Frames with CSS aspect-ratio ↗
  • Keep the Subject in Frame with CSS object-fit and object-position ↗

Browse the full blog →

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Footer

phone – (816)694-0458
email – kolten@webdesignkc.com

copyright © 2026

WebDesignKC-Logo-Teel

let’s work together on
your next project!

contact

Copyright © 2026 • WebDesignKC • Design by Web Design KC Logo