<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Seth Jeffery</title>
    <description>The latest articles on DEV Community by Seth Jeffery (@seth_jeffery_582c02fd29f0).</description>
    <link>https://dev.to/seth_jeffery_582c02fd29f0</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1537934%2F63441d2f-2166-44c0-9739-fed3d2e3e2cb.jpg</url>
      <title>DEV Community: Seth Jeffery</title>
      <link>https://dev.to/seth_jeffery_582c02fd29f0</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/seth_jeffery_582c02fd29f0"/>
    <language>en</language>
    <item>
      <title>Clamping font weights</title>
      <dc:creator>Seth Jeffery</dc:creator>
      <pubDate>Thu, 13 Aug 2026 11:44:30 +0000</pubDate>
      <link>https://dev.to/seth_jeffery_582c02fd29f0/clamping-font-weights-4h7e</link>
      <guid>https://dev.to/seth_jeffery_582c02fd29f0/clamping-font-weights-4h7e</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fukywc1g5xo96kig1gy9e.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fukywc1g5xo96kig1gy9e.gif" alt=" " width="616" height="184"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you like front-end design, you probably love &lt;code&gt;clamp()&lt;/code&gt;. It's a great way to shrink down your text progressively depending on viewport size, instead of defining breakpoints that snap.&lt;/p&gt;

&lt;p&gt;With &lt;strong&gt;CSS containers&lt;/strong&gt;, we can even clamp font-size based on its container.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/Seth-Jeffery-the-scripter/embed/GgraZwd?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;But with variable-weight fonts, did you know that you can even progressively change the &lt;strong&gt;weight&lt;/strong&gt; of your text?&lt;/p&gt;

&lt;p&gt;Out of the box, &lt;strong&gt;it won't work&lt;/strong&gt;, because clamping expects you to supply units, and font weights do not use units. The trick here is to &lt;strong&gt;divide by 1 unit&lt;/strong&gt;, which effectively removes it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;font-weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;calc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;clamp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;400px&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;200&lt;/span&gt;&lt;span class="n"&gt;cqw&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;800px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;/&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The resulting effect is quite nice.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/Seth-Jeffery-the-scripter/embed/QwdRNoR?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;This is great for big bold headings that progressively shrink on smaller devices in order to read nicely.&lt;/p&gt;

&lt;p&gt;Put it all together, add some paragraph text, and you've got a beautiful typography system that includes progressive font weighting, and can adjust based on both viewports and containers.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/Seth-Jeffery-the-scripter/embed/QwdRNXX?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
